gh-83653: Do not save a blank int entry in IDLE Settings#152743
Open
serhiy-storchaka wants to merge 1 commit into
Open
gh-83653: Do not save a blank int entry in IDLE Settings#152743serhiy-storchaka wants to merge 1 commit into
serhiy-storchaka wants to merge 1 commit into
Conversation
Blanking an integer entry wrote an empty string to the config file, which caused an "invalid int value" warning when it was read back. Co-authored-by: Cheryl Sabella <cheryl.sabella@gmail.com>
a3879c2 to
a3e8132
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Integer entry fields in the Settings dialog use a
StringVarwith a default per-keystroke callback that writes the raw value tochanges. Deleting all digits from a field (e.g. "Auto squeeze min lines") wrote an empty string to the config file, which then produced aWarning: config.py - IdleConf.GetOption - invalid 'int' valuewhen the option was read back.The default callback now skips empty values. These entries are
digits_only-validated, so blank is the only invalid value they can produce. The check isvalue != ''rather than a truthiness test so thatIntVar0andBooleanVarFalseare still saved. Legitimate empty values (such as the second theme/key-set name) go through named callbacks, not this one.Spinoff of gh-79597 (bpo-31414). The added test covers a blanked entry being skipped and a valid entry being saved.
Credit to Cheryl Sabella (@csabella), who reported this bug with a reproducer and wrote the original
VarTraceint-entry handling (bpo-30853) that this change completes.🤖 Generated with Claude Code