[issue40600] Add option to disallow > 1 instance of an extension module

STINNER Victor report at bugs.python.org
Thu Sep 10 06:00:12 EDT 2020


STINNER Victor <vstinner at python.org> added the comment:

One option is to get the behavior before multi-phase initialization. We store extensions in a list. Once it's load, it cannot be unloaded before we exit Python. See _PyState_AddModule() and _PyState_AddModule().

Calling PyInit_xxx() the second time would simply return the existing module object.

When we exit Python, the clear and/or free function of the module is called.

----------

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


More information about the Python-bugs-list mailing list