[Python-Dev] PEP 489: module m_traverse called with NULL module state (original) (raw)
Petr Viktorin encukou at gmail.com
Tue Dec 19 10:10:06 EST 2017
- Previous message (by thread): [Python-Dev] PEP 489: module m_traverse called with NULL module state
- Next message (by thread): [Python-Dev] PEP 489: module m_traverse called with NULL module state
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Thu, Dec 14, 2017 at 12:00 PM, Antoine Pitrou <solipsis at pitrou.net> wrote:
On Thu, 14 Dec 2017 17:00:10 +1000 Nick Coghlan <ncoghlan at gmail.com> wrote:
On 14 Dec. 2017 9:19 am, "Antoine Pitrou" <solipsis at pitrou.net> wrote:
Hello, After debugging a crash on AppVeyor for a submitter's PR (see https://github.com/python/cpython/pull/4611 ), I came to the following diagnosis: converting the "atexit" module (which is a built-in C extension) to PEP 489 multiphase initialization can lead to its mtraverse function (and presumably also mclear and mfree) to be called while not module state is yet registered: that is,
PyModuleGetState(self)
when called from mtraverse returns NULL! Is that an expected or known subtlety? Not that I'm aware of, so I'd be inclined to classify it as a bug in the way we're handling multi-phase initialisation unless/until we determine there's no way to preserve the existing invariant from the single phase case. Speaking of which, the doc is not very clear: is PEP 489 required for multi-interpreter support or is PyModuleGetState() sufficient?
Yes, it is possible to have proper subinterpreter support without multi-phase init.
- Previous message (by thread): [Python-Dev] PEP 489: module m_traverse called with NULL module state
- Next message (by thread): [Python-Dev] PEP 489: module m_traverse called with NULL module state
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]