[Python-Dev] PEP 489: module m_traverse called with NULL module state
Nick Coghlan
ncoghlan at gmail.com
Thu Dec 14 02:00:10 EST 2017
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 m_traverse function (and presumably also m_clear and m_free) to be
called while not module state is yet registered: that is,
`PyModule_GetState(self)` when called from m_traverse 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.
Cheers,
Nick.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20171214/48b29dd3/attachment.html>
More information about the Python-Dev
mailing list