Skip to content

gh-153477: Fix IDLE startup crash on a corrupt user config file#153478

Open
tonghuaroot wants to merge 1 commit into
python:mainfrom
tonghuaroot:idlelib-config-corrupt-load
Open

gh-153477: Fix IDLE startup crash on a corrupt user config file#153478
tonghuaroot wants to merge 1 commit into
python:mainfrom
tonghuaroot:idlelib-config-corrupt-load

Conversation

@tonghuaroot

@tonghuaroot tonghuaroot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

IdleConfParser.Load called configparser's read_file with no error handling, so a corrupt or partially written user configuration file (for example one left behind by an interrupted Save) raised a configparser.Error such as MissingSectionHeaderError and aborted IDLE startup. This contradicts the graceful-degradation behavior documented in the config.py module docstring.

Load now catches configparser.Error, warns to stderr, and falls back to the default configuration. The regression test writes a headerless config file and checks that Load warns and leaves the parser empty instead of raising.

IdleConfParser.Load raised the configparser exception on a corrupt or
partially written user configuration file, which aborted IDLE startup.
Catch it, warn, and fall back to the default configuration, matching the
module's documented graceful-degradation behavior.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant