Skip to content

gh-75595: Do not save a blank int entry in IDLE Settings#152743

Merged
terryjreedy merged 1 commit into
python:mainfrom
serhiy-storchaka:gh-83653-config-int-blank
Jul 1, 2026
Merged

gh-75595: Do not save a blank int entry in IDLE Settings#152743
terryjreedy merged 1 commit into
python:mainfrom
serhiy-storchaka:gh-83653-config-int-blank

Conversation

@serhiy-storchaka

@serhiy-storchaka serhiy-storchaka commented Jul 1, 2026

Copy link
Copy Markdown
Member

Integer entry fields in the Settings dialog use a StringVar with a default per-keystroke callback that writes the raw value to changes. Deleting all digits from a field (e.g. "Auto squeeze min lines") wrote an empty string to the config file, which then produced a Warning: config.py - IdleConf.GetOption - invalid 'int' value when 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 is value != '' rather than a truthiness test so that IntVar 0 and BooleanVar False are still saved. Legitimate empty values (such as the second theme/key-set name) go through named callbacks, not this one.

Spinoff of gh-75595. The added test covers a blanked entry being skipped and a valid entry being saved.
Also related to gh-83653.

Credit to Cheryl Sabella (@csabella), who reported this bug with a reproducer and wrote the original VarTrace int-entry handling (gh-75036) that this change completes.

🤖 Generated with Claude Code

@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 Jul 1, 2026
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>
@serhiy-storchaka serhiy-storchaka force-pushed the gh-83653-config-int-blank branch from a3879c2 to a3e8132 Compare July 1, 2026 06:59
@terryjreedy terryjreedy changed the title gh-83653: Do not save a blank int entry in IDLE Settings gh-75595: Do not save a blank int entry in IDLE Settings Jul 1, 2026
@terryjreedy

Copy link
Copy Markdown
Member

It was not obvious whether you intended this as an additional PR for #75595 or a fix for #83653, so it is linked to both. If the latter, I will leave it open a bit to see if I want to save elsewhere other ideas contained within. In the meanwhile, I am merging.

@terryjreedy terryjreedy merged commit 3428762 into python:main Jul 1, 2026
51 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 Jul 1, 2026

Copy link
Copy Markdown

GH-152827 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 Jul 1, 2026
@bedevere-app

bedevere-app Bot commented Jul 1, 2026

Copy link
Copy Markdown

GH-152828 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 Jul 1, 2026
@bedevere-app

bedevere-app Bot commented Jul 1, 2026

Copy link
Copy Markdown

GH-152829 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 Jul 1, 2026
terryjreedy pushed a commit that referenced this pull request Jul 1, 2026
…52743) (#152829)

gh-75595: Do not save a blank int entry in IDLE Settings (GH-152743)

gh-83653: Do not save a blank int entry in IDLE Settings

Blanking an integer entry wrote an empty string to the config file, which
caused an "invalid int value" warning when it was read back.
(cherry picked from commit 3428762)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Cheryl Sabella <cheryl.sabella@gmail.com>
terryjreedy pushed a commit that referenced this pull request Jul 1, 2026
…52743) (#152828)

gh-75595: Do not save a blank int entry in IDLE Settings (GH-152743)

gh-83653: Do not save a blank int entry in IDLE Settings

Blanking an integer entry wrote an empty string to the config file, which
caused an "invalid int value" warning when it was read back.
(cherry picked from commit 3428762)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Cheryl Sabella <cheryl.sabella@gmail.com>
terryjreedy pushed a commit that referenced this pull request Jul 1, 2026
…52743) (#152827)

gh-75595: Do not save a blank int entry in IDLE Settings (GH-152743)

gh-83653: Do not save a blank int entry in IDLE Settings

Blanking an integer entry wrote an empty string to the config file, which
caused an "invalid int value" warning when it was read back.
(cherry picked from commit 3428762)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Cheryl Sabella <cheryl.sabella@gmail.com>
@serhiy-storchaka serhiy-storchaka deleted the gh-83653-config-int-blank branch July 2, 2026 03:48
@serhiy-storchaka

Copy link
Copy Markdown
Member Author

Yes, this is actually a fix for #83653 which incorrectly refers to it's parent issue in the title.

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