diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2019-09-17 06:24:02 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-09-17 06:24:02 (GMT) |
commit | 3d916a7b1ee29896bece4a6a37d8084fa3c1abf6 (patch) | |
tree | dec4fbd6bce58e483ea79371e7bf53c1bb115afe /Lib/idlelib/editor.py | |
parent | 4ac1be28281d8961e71b13623c3671245c125760 (diff) | |
download | cpython-3d916a7b1ee29896bece4a6a37d8084fa3c1abf6.zip cpython-3d916a7b1ee29896bece4a6a37d8084fa3c1abf6.tar.gz cpython-3d916a7b1ee29896bece4a6a37d8084fa3c1abf6.tar.bz2 |
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.
(cherry picked from commit dfd34a9cd58e8150c324190f746de919e140abe8)
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Diffstat (limited to 'Lib/idlelib/editor.py')
-rw-r--r-- | Lib/idlelib/editor.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/Lib/idlelib/editor.py b/Lib/idlelib/editor.py index 838cb04..b969f8c 100644 --- a/Lib/idlelib/editor.py +++ b/Lib/idlelib/editor.py @@ -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: |