Title: IDLE: Quitting with a new, unsaved editor window causes an exception
Type: behavior Stage:
Components: IDLE Versions: Python 3.9, Python 3.8, Python 3.7
Status: open Resolution:
Dependencies: Superseder:
Assigned To: terry.reedy Nosy List: cajetan.rodrigues, taleinat, terry.reedy
Priority: normal Keywords:

Created on 2019-07-10 19:12 by taleinat, last changed 2020-04-25 00:22 by cajetan.rodrigues.

Messages (5)
msg347636 - (view) Author: Tal Einat (taleinat) * (Python committer) Date: 2019-07-10 19:12
Observed on macOS 10.14.5 with Python 3.8 from, and with latest master branch.

1. Open IDLE
2. "New File" (Cmd-Shift-n on macOS)
3. Quit using Cmd-q ("Quit Python" from the menu doesn't cause this!)

The exception traceback:
Exception in Tkinter callback
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/tkinter/", line 1883, in __call__
    return self.func(*args)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/idlelib/", line 176, in handler
    r = l[i](event)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/idlelib/", line 54, in close_all_callback
    reply = edit.close()
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/idlelib/", line 1021, in close
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/idlelib/", line 312, in _close
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/idlelib/", line 1025, in _close
AttributeError: 'NoneType' object has no attribute 'filename'
msg347748 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2019-07-12 15:34
I see the traceback I reported on #37524, whichever way I close.  In both cases, EditorWindow.close is called and we get an AttributeError because a file has become None. close() calls maybesave before _close, so the exception I see happens before _close is called.  It is possible I have seen this, before the #37524 errors started.  See latter for possible fix.
msg347885 - (view) Author: Tal Einat (taleinat) * (Python committer) Date: 2019-07-14 08:24
Doesn't reproduce on Win10 with current master.
msg347898 - (view) Author: Tal Einat (taleinat) * (Python committer) Date: 2019-07-14 09:10
This also happens on Ubuntu 18.10, with a traceback similar to that reported on issue #37524:

Exception ignored in: < object at 0x7f2d93b17410>
Traceback (most recent call last):
  File "Lib/idlelib/", line 488, in close
  File "Lib/idlelib/", line 1017, in close
  File "Lib/idlelib/", line 1019, in close
  File "Lib/idlelib/", line 94, in maybesave
  File "Lib/idlelib/", line 952, in get_saved
AttributeError: 'NoneType' object has no attribute 'get_saved'
msg367245 - (view) Author: Cajetan Rodrigues (cajetan.rodrigues) * Date: 2020-04-25 00:22
Cannot reproduce on Ubuntu 19.10 with idle3.9 
(Python 3.9.0a5+ (heads/master:a25a04fea5, Apr 20 2020, 22:35:10))
Date User Action Args
2020-04-25 00:22:01cajetan.rodriguessetnosy: + cajetan.rodrigues
messages: + msg367245
2019-07-14 09:10:55taleinatsetmessages: + msg347898
2019-07-14 08:24:44taleinatsetmessages: + msg347885
2019-07-12 15:34:40terry.reedysetmessages: + msg347748
2019-07-10 19:12:06taleinatcreate