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 dfd34a9cd5)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
This commit is contained in:
Miss Islington (bot) 2019-09-16 23:23:12 -07:00 committed by GitHub
parent f04299d978
commit 73ccc3322f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 4 deletions

View 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: