[issue4200] atexit module not safe in Python 3.0 with multiple interpreters

Martin v. Löwis report at bugs.python.org
Sun Oct 26 19:36:14 CET 2008


Martin v. Löwis <martin at v.loewis.de> added the comment:

It would certainly be possible to produce per-interpreter callback lists
through the module state. You declare a per-interpreter structure, add
its size into atexitmodule, and refer to it through PyModule_GetDef,
passing the self argument of the module-level functions.

Reviewing the code, I have two unrelated remarks:
- METH_NOARGS functions still take two arguments.
- I would drop the double-indirection of the callback list. Instead,
allocate a single block of atexit_callback, and use func==NULL as an
indicator that the block is free.

According to the documentation of the atexit module, it seems clear that
it is a per-interpreter thing.

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue4200>
_______________________________________


More information about the Python-bugs-list mailing list