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.
This commit is contained in:
Terry Jan Reedy 2019-09-17 02:05:04 -04:00 committed by GitHub
parent 63dedef48b
commit dfd34a9cd5
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: