https://github.com/python/cpython/commit/d78d8f269c90014a2e9d289e71dc927172dcf59f commit: d78d8f269c90014a2e9d289e71dc927172dcf59f branch: 3.13 author: Miss Islington (bot) <[email protected]> committer: terryjreedy <[email protected]> date: 2026-09-22T19:38:04Z summary:
[3.13] gh-75487: Do not save a truncated number when an int entry is blanked in IDLE Settings (GH-157680) (#157964) The value is recorded on every keystroke, so blanking "80" with the Backspace key left "8" to be saved. Blanking an entry now forgets the recorded value, so that the saved value is kept. (cherry picked from commit f67c51fb6077f759b048727cf367fdb2c88d3a19) Co-authored-by: Serhiy Storchaka <[email protected]> files: A Misc/NEWS.d/next/IDLE/2026-09-17-17-00-00.gh-issue-75487.blankint.rst M Lib/idlelib/configdialog.py M Lib/idlelib/idle_test/test_configdialog.py diff --git a/Lib/idlelib/configdialog.py b/Lib/idlelib/configdialog.py index a5d1aaeb5a946f..02133ce022d79e 100644 --- a/Lib/idlelib/configdialog.py +++ b/Lib/idlelib/configdialog.py @@ -2285,10 +2285,13 @@ def make_callback(var, config): def default_callback(*params): "Add config values to changes instance." value = var.get() - # A blanked int entry is an empty string; do not save it as an - # invalid config value (gh-83653). if value != '': changes.add_option(*config, value) + else: + # A blanked int entry: do not save an invalid value, and + # forget the value recorded while editing (gh-75487). + config_type, section, item = config + changes[config_type].get(section, {}).pop(item, None) return default_callback def attach(self): diff --git a/Lib/idlelib/idle_test/test_configdialog.py b/Lib/idlelib/idle_test/test_configdialog.py index 12927bee8d31fb..0d2a1747275e65 100644 --- a/Lib/idlelib/idle_test/test_configdialog.py +++ b/Lib/idlelib/idle_test/test_configdialog.py @@ -1712,6 +1712,10 @@ def test_make_callback(self): sv.set('5') cb() self.assertEqual(changes['main']['section']['option'], '5') + # gh-75487: blanking the entry forgets the value recorded before. + sv.set('') + cb() + self.assertNotIn('option', changes['main']['section']) changes.clear() def test_attach_detach(self): diff --git a/Misc/NEWS.d/next/IDLE/2026-09-17-17-00-00.gh-issue-75487.blankint.rst b/Misc/NEWS.d/next/IDLE/2026-09-17-17-00-00.gh-issue-75487.blankint.rst new file mode 100644 index 00000000000000..5ae2d360f5c6a9 --- /dev/null +++ b/Misc/NEWS.d/next/IDLE/2026-09-17-17-00-00.gh-issue-75487.blankint.rst @@ -0,0 +1,2 @@ +Fix saving a truncated number when an integer entry in the IDLE Settings +dialog is blanked with the Backspace key. _______________________________________________ Python-checkins mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3//lists/python-checkins.python.org Member address: [email protected]
