This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author terry.reedy
Recipients cheryl.sabella, ned.deily, rhettinger, serhiy.storchaka, taleinat, terry.reedy
Date 2019-09-17.06:04:03
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
By reading idlelib code, I determined that the error must arise from EditorWindow.close being called twice.  I confirmed this with a debug print.

EW.close is called from close_event, PyShell.close, and filelist.close_all_callback. For the AttributeError I see, msg352409, both calls come from PyShell.close (debug print) and at least the second from PseudoInputFile.close.  Since it does not happen in 3.7, in spite of code being identical, a 3.8 change in Python shutdown must be involved.

I am rather sure that a double close is also the problem on Raymond's mac, with at least the second coming from close_all_callback.  The latter is invoked by File => exit and exit() or quit().  It might be that I do not remember seeing the same traceback because I almost never exit that way.  On Windows, I often right click the IDLE taskbar icon and select 'close all windows'.  Or the binding of close_all_callback in macOSX might be involved.

As a practical matter, I am defining the bug to be fixed as printing an annoying and essentially useless traceback to a terminal used to start IDLE.  I could spend hours trying to prevent the 2nd call I see and even if I succeeded, there would still be the 2nd call I don't see, and the problem that prompted #17822.  Clean tk shutdown is tricky and there are other unresolved issues with IDLE tests.

PR 10564 uses the direct approach suggested by Tal.  It works for me however I shut down IDLE.

Setting a Boolean flag after the first call might be cleaner, but I don't know for sure that it would prevent what Raymond sees, and I want to get a fix into 3.7.5, and I am more sure that catching AttributeErrors will work for him as well.
Date User Action Args
2019-09-17 06:04:03terry.reedysetrecipients: + terry.reedy, rhettinger, taleinat, ned.deily, serhiy.storchaka, cheryl.sabella
2019-09-17 06:04:03terry.reedysetmessageid: <>
2019-09-17 06:04:03terry.reedylinkissue35379 messages
2019-09-17 06:04:03terry.reedycreate