]> granicus.if.org Git - python/commitdiff
bpo-35379: When exiting IDLE, catch any AttributeError. (GH-16212)
authorTerry Jan Reedy <tjreedy@udel.edu>
Tue, 17 Sep 2019 06:05:04 +0000 (02:05 -0400)
committerGitHub <noreply@github.com>
Tue, 17 Sep 2019 06:05:04 +0000 (02:05 -0400)
One happens when EditorWindow.close is called twice.
Printing a traceback, when IDLE is run from a terminal,
is useless and annoying.

Lib/idlelib/NEWS.txt
Lib/idlelib/editor.py
Misc/NEWS.d/next/IDLE/2019-09-17-01-28-56.bpo-35379.yAECDr.rst [new file with mode: 0644]

index 3ccc5c07fb0046cb3f9f8fbd15eb11e72018057c..9d26bda42594ec9036e0d9af3a3c09b6f16eb04c 100644 (file)
@@ -2,6 +2,13 @@ What's New in IDLE 3.8.0 (since 3.7.0)
 Released on 2019-10-20?
 ======================================
 
+bpo-35379: When exiting IDLE, catch any AttributeError.  One happens
+when EditorWindow.close is called twice.  Printing a traceback, when
+IDLE is run from a terminal, is useless and annoying.
+
+bpo-38183: To avoid test issues, test_idle ignores the user config
+directory.  It no longer tries to create or access .idlerc or any files
+within.  Users must run IDLE to discover problems with saving settings.
 
 bpo-38077: IDLE no longer adds 'argv' to the user namespace when
 initializing it.  This bug only affected 3.7.4 and 3.8.0b2 to 3.8.0b4.
index 838cb04b800897338f96a896726e3c1b7b01683c..b969f8c493b27765a49ea930a58e2427a4a78ece 100644 (file)
@@ -1061,10 +1061,13 @@ class EditorWindow(object):
             return self.io.maybesave()
 
     def close(self):
-        reply = self.maybesave()
-        if str(reply) != "cancel":
-            self._close()
-        return reply
+        try:
+            reply = self.maybesave()
+            if str(reply) != "cancel":
+                self._close()
+            return reply
+        except AttributeError:  # bpo-35379: close called twice
+            pass
 
     def _close(self):
         if self.io.filename:
diff --git a/Misc/NEWS.d/next/IDLE/2019-09-17-01-28-56.bpo-35379.yAECDr.rst b/Misc/NEWS.d/next/IDLE/2019-09-17-01-28-56.bpo-35379.yAECDr.rst
new file mode 100644 (file)
index 0000000..98d4167
--- /dev/null
@@ -0,0 +1,3 @@
+When exiting IDLE, catch any AttributeError.  One happens when
+EditorWindow.close is called twice.  Printing a traceback, when IDLE is run
+from a terminal, is useless and annoying.