[issue42935] Pickle can't import builtins at exit

Christian Heimes report at bugs.python.org
Sat Jan 16 15:51:41 EST 2021


Christian Heimes <lists at cheimes.de> added the comment:

At the end of a Python process, the interpreter is shut down in multiple steps. Object finalizers such as __del__ may be executed late in the interpreter shut down process. In your case, most of the interpreter is already gone. There isn't anything we can do to solve the problem.

That's why we recommend explicit resource management with the "with" statement. The atexit module is another way to execute cleanup hooks before the interpreter is shut down.

----------
nosy: +christian.heimes

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue42935>
_______________________________________


More information about the Python-bugs-list mailing list