Message379971
I hacked logging.FileHandler to keep a reference to the builtin open() function. I got new problems.
In my test, I got a crash because of an unclosed file. It happens after PyInterpreterState_Clear(), in finalize_interp_clear():
/* Last explicit GC collection */
_PyGC_CollectNoFail();
setup_context() of Python/_warings.c does crash because tstate->interp->sysdict is NULL at this point.
Moreover, _io.TextIOWrapper.__init__() fails to import the locale module (to call locale.getpreferredencoding(), since the encoding is None) and picks the "ascii" encoding.
Moreover, even if I work around all these issues, _warnings.showwarnings() logs "lost sys.stderr" into stderr because, again, tstate->interp->sysdict is NULL at this point (and so sys.stderr no longer exists).
It looks like a bug in finalize_interp_clear() which triggers a garbage collection, whereas Python is no longer usable. |
|
Date |
User |
Action |
Args |
2020-10-30 14:32:19 | vstinner | set | recipients:
+ vstinner, vinay.sajip, smurfix, r.david.murray, methane, serhiy.storchaka, yselivanov, veky, Peer Sommerlund, JanVok, Charles Bouchard-Légaré, Sandeep |
2020-10-30 14:32:19 | vstinner | set | messageid: <1604068339.89.0.187805594311.issue26789@roundup.psfhosted.org> |
2020-10-30 14:32:19 | vstinner | link | issue26789 messages |
2020-10-30 14:32:19 | vstinner | create | |
|