Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit dfd34a9

Browse files
authored
bpo-35379: When exiting IDLE, catch any AttributeError. (GH-16212)
One happens when EditorWindow.close is called twice. Printing a traceback, when IDLE is run from a terminal, is useless and annoying.
1 parent 63dedef commit dfd34a9

3 files changed

Lines changed: 17 additions & 4 deletions

File tree

Lib/idlelib/NEWS.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@ What's New in IDLE 3.8.0 (since 3.7.0)
22
Released on 2019-10-20?
33
======================================
44

5+
bpo-35379: When exiting IDLE, catch any AttributeError. One happens
6+
when EditorWindow.close is called twice. Printing a traceback, when
7+
IDLE is run from a terminal, is useless and annoying.
8+
9+
bpo-38183: To avoid test issues, test_idle ignores the user config
10+
directory. It no longer tries to create or access .idlerc or any files
11+
within. Users must run IDLE to discover problems with saving settings.
512

613
bpo-38077: IDLE no longer adds 'argv' to the user namespace when
714
initializing it. This bug only affected 3.7.4 and 3.8.0b2 to 3.8.0b4.

Lib/idlelib/editor.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1061,10 +1061,13 @@ def maybesave(self):
10611061
return self.io.maybesave()
10621062

10631063
def close(self):
1064-
reply = self.maybesave()
1065-
if str(reply) != "cancel":
1066-
self._close()
1067-
return reply
1064+
try:
1065+
reply = self.maybesave()
1066+
if str(reply) != "cancel":
1067+
self._close()
1068+
return reply
1069+
except AttributeError: # bpo-35379: close called twice
1070+
pass
10681071

10691072
def _close(self):
10701073
if self.io.filename:
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
When exiting IDLE, catch any AttributeError. One happens when
2+
EditorWindow.close is called twice. Printing a traceback, when IDLE is run
3+
from a terminal, is useless and annoying.

0 commit comments

Comments
 (0)