Skip to content

Update _progress_bar.py #6052

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Update _progress_bar.py #6052

wants to merge 1 commit into from

Conversation

cartland
Copy link

This library crashes when total_imaginary_width == 0.0 because the modulo cannot divide by zero. Although it's probably a bug if the a user of the library is trying to render something with width == 0, the library doesn't need to crash here.

We can use start = 0.0 as a reasonable value for a width of 0.

I came across this issue because I am using a collection of libraries that ultimately depend on this library. Since I'm not an owner of the libraries using this API, I thought it would be easiest to address this crash instead of changing the usage of libraries that depend on this one.

Please review the following checklist.

  • [?] Docstrings on all new or modified functions / classes: I don't know enough about the context for render_indeterminate() or RenderResult to provide a useful docstring. I am just trying to fix a crash.
  • [?] Updated documentation: I do not know enough about the documentation to determine if this needs additional documentation.
  • [?] Updated CHANGELOG.md (where appropriate): I do not know enough about the prevalence of this issue to know if it's worth a CHANGELOG.md update.

This library crashes when total_imaginary_width == 0.0 because the modulo cannot divide by zero. Although it's probably a bug if the a user of the library is trying to render something with width == 0, the library doesn't need to crash here.

We can use start = 0.0 as a reasonable value for a width of 0.
@willmcgugan
Copy link
Member

I'll need a regression test for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants