https://github.com/python/cpython/commit/4e8785f312ef8be090ccd610b2b6994d0486ff72
commit: 4e8785f312ef8be090ccd610b2b6994d0486ff72
branch: 3.14
author: Miss Islington (bot) <[email protected]>
committer: terryjreedy <[email protected]>
date: 2026-07-01T22:23:22Z
summary:

[3.14] gh-75595: Do not save a blank int entry in IDLE Settings (GH-152743) 
(#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 3428762f33c6c064998f5b0c385cdfd0f0c2e198)

Co-authored-by: Serhiy Storchaka <[email protected]>
Co-authored-by: Cheryl Sabella <[email protected]>

files:
A Misc/NEWS.d/next/IDLE/2026-07-01-18-00-00.gh-issue-83653.cFgInt.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 e618ef07a90271..883e2e73ee42a4 100644
--- a/Lib/idlelib/configdialog.py
+++ b/Lib/idlelib/configdialog.py
@@ -2257,7 +2257,11 @@ def make_callback(var, config):
         "Return default callback function to add values to changes instance."
         def default_callback(*params):
             "Add config values to changes instance."
-            changes.add_option(*config, var.get())
+            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)
         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 2773ed7ce614b5..c68fd304ea4235 100644
--- a/Lib/idlelib/idle_test/test_configdialog.py
+++ b/Lib/idlelib/idle_test/test_configdialog.py
@@ -1544,6 +1544,17 @@ def test_make_callback(self):
         self.assertEqual(changes['main']['section']['option'], '42')
         changes.clear()
 
+        # gh-83653: a blank int entry is not saved as bad config data.
+        sv = StringVar(root)
+        cb = self.tracers.make_callback(sv, ('main', 'section', 'option'))
+        sv.set('')
+        cb()
+        self.assertNotIn('section', changes['main'])
+        sv.set('5')
+        cb()
+        self.assertEqual(changes['main']['section']['option'], '5')
+        changes.clear()
+
     def test_attach_detach(self):
         tr = self.tracers
         iv = tr.add(self.iv, self.var_changed_increment)
diff --git 
a/Misc/NEWS.d/next/IDLE/2026-07-01-18-00-00.gh-issue-83653.cFgInt.rst 
b/Misc/NEWS.d/next/IDLE/2026-07-01-18-00-00.gh-issue-83653.cFgInt.rst
new file mode 100644
index 00000000000000..5812b2dd977f6a
--- /dev/null
+++ b/Misc/NEWS.d/next/IDLE/2026-07-01-18-00-00.gh-issue-83653.cFgInt.rst
@@ -0,0 +1,3 @@
+Blanking an integer entry in IDLE's Settings dialog, such as "Auto squeeze
+min lines", no longer saves an empty string as an invalid configuration
+value.

_______________________________________________
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]

Reply via email to