Thanks to visit codestin.com
Credit goes to github.com

Skip to content

gh-90304: Fix IDLE startup failure with a broken font - #152419

Merged
terryjreedy merged 1 commit into
python:mainfrom
serhiy-storchaka:idle-set-width-zerodiv
Sep 13, 2026
Merged

gh-90304: Fix IDLE startup failure with a broken font#152419
terryjreedy merged 1 commit into
python:mainfrom
serhiy-storchaka:idle-set-width-zerodiv

Conversation

@serhiy-storchaka

Copy link
Copy Markdown
Member

On some systems a font reports a zero width for the '0' character (seen with a broken font on openSUSE). EditorWindow.set_width() divides the Text widget's pixel width by that value, so the ZeroDivisionError prevented IDLE from starting at all.

set_width() now falls back to the configured width when the measured width is zero. self.width is consumed by the === RESTART === separator in the shell and by the squeezer's line wrapping.

A font reporting a zero width for '0' made set_width() raise
ZeroDivisionError. It now falls back to the configured width.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@serhiy-storchaka serhiy-storchaka added needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes needs backport to 3.15 pre-release feature fixes, bugs and security fixes labels Jun 27, 2026
@terryjreedy
terryjreedy merged commit 8a2db99 into python:main Sep 13, 2026
101 of 103 checks passed
@miss-islington-app

Copy link
Copy Markdown

Thanks @serhiy-storchaka for the PR, and @terryjreedy for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14, 3.15.
🐍🍒⛏🤖

@bedevere-app

bedevere-app Bot commented Sep 13, 2026

Copy link
Copy Markdown

GH-157395 is a backport of this pull request to the 3.15 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.15 pre-release feature fixes, bugs and security fixes label Sep 13, 2026
@bedevere-app

bedevere-app Bot commented Sep 13, 2026

Copy link
Copy Markdown

GH-157396 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.14 bugs and security fixes label Sep 13, 2026
@bedevere-app

bedevere-app Bot commented Sep 13, 2026

Copy link
Copy Markdown

GH-157397 is a backport of this pull request to the 3.13 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.13 bugs and security fixes label Sep 13, 2026
terryjreedy pushed a commit that referenced this pull request Sep 13, 2026
…) (#157396)

gh-90304: Fix IDLE startup failure with a broken font (GH-152419)

On some systems a font reports a zero width for the '0' character (seen with a broken font on openSUSE). EditorWindow.set_width() divides the Text widget's pixel width by that value, so the ZeroDivisionError prevented IDLE from starting at all.

set_width() now falls back to the configured width when the measured width is zero. self.width is consumed by the === RESTART === separator in the shell and by the squeezer's line wrapping.
(cherry picked from commit 8a2db99)

Co-authored-by: Serhiy Storchaka <[email protected]>
Co-authored-by: Claude Opus 4.8 <[email protected]>
terryjreedy pushed a commit that referenced this pull request Sep 13, 2026
…) (#157397)

gh-90304: Fix IDLE startup failure with a broken font (GH-152419)

On some systems a font reports a zero width for the '0' character (seen with a broken font on openSUSE). EditorWindow.set_width() divides the Text widget's pixel width by that value, so the ZeroDivisionError prevented IDLE from starting at all.

set_width() now falls back to the configured width when the measured width is zero. self.width is consumed by the === RESTART === separator in the shell and by the squeezer's line wrapping.
(cherry picked from commit 8a2db99)

Co-authored-by: Serhiy Storchaka <[email protected]>
Co-authored-by: Claude Opus 4.8 <[email protected]>
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