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 vstinner
Recipients Barry Davis, ionelmc, neologix, nikicat, pitrou, vstinner, xtreak, zwol
Date 2019-06-12.23:24:51
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
I closed the issue. I consider that the initial issue has been fixed and all related issues have been fixed as well:

* Python 3.8 now logs close() exception in file finalizer in development mode (-X dev) and debug mode (./configure --with-pydebug)
* I added sys.unraisablehook to Python 3.8 which allows to decide how these unraisable exceptions are handled
* Tests no longer log any "unraisable exception" in file finalizers (test_io and test_urllib have been fixed)
* regrtest now marks a test as ENV_CHANGED if it logs an unraisable exception (like the close() exception)


For Python 3.7, there is no known workaround.

It seems like Python 2.7 in debug mode logs an error:

$ python2.7-dbg 
close failed in file object destructor:
IOError: [Errno 9] Bad file descriptor
Date User Action Args
2019-06-12 23:24:52vstinnersetrecipients: + vstinner, pitrou, ionelmc, neologix, nikicat, zwol, Barry Davis, xtreak
2019-06-12 23:24:52vstinnersetmessageid: <>
2019-06-12 23:24:52vstinnerlinkissue18748 messages
2019-06-12 23:24:51vstinnercreate