Skip to content

Handle zero totals in ProgressBar text display. - #15442

Merged
Carreau merged 1 commit into
ipython:mainfrom
sushu0:codex/fix-progressbar-zero-total
Oct 21, 2026
Merged

Carreau merged 1 commit into
ipython:mainfrom
sushu0:codex/fix-progressbar-zero-total

Conversation

@sushu0

@sushu0 sushu0 commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

ProgressBar(len(items)) cannot display an empty workload: when items is empty, its plain-text representation divides by zero. Iterating the empty bar also triggers the same error while displaying it.

from IPython.display import ProgressBar

repr(ProgressBar(0))
list(ProgressBar(0))

Treat a zero total as an empty text bar with a 0/0 count. Nonzero totals keep their existing fraction calculation.

Regression coverage includes the zero-total text representation and parameterized empty/nonempty iteration, checking both the yielded values and the displayed final count.

Prepared with an OpenAI Codex agent. 🤖🤖

Copilot AI balanced review requested due to automatic review settings October 20, 2026 13:05

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@sushu0

sushu0 commented Oct 20, 2026

Copy link
Copy Markdown
Contributor Author

CI follow-up for f7027beafcfaca97b5da0fbc0110ed3c0337fdfa:

  • Run tests completed successfully across all 13 jobs, including Windows, Linux, macOS, oldest dependencies, free-threaded Python 3.14 and Python 3.15-dev.
  • The remaining failures also occur on this PR's exact base commit, 4e690135c8743988b46c4268ea76a7dfd1c83efc:

🤖🤖

@Carreau
Carreau force-pushed the codex/fix-progressbar-zero-total branch from f7027be to 9ce674f Compare October 21, 2026 09:40
@Carreau Carreau changed the title Handle zero totals in ProgressBar text display 🤖🤖 Handle zero totals in ProgressBar text display. Oct 21, 2026
@Carreau
Carreau merged commit 08d2df6 into ipython:main Oct 21, 2026
24 checks passed
@Carreau Carreau added this to the 9.18 milestone Oct 21, 2026
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.

3 participants