<div dir="auto"><div><br><div class="gmail_extra"><br><div class="gmail_quote">On 14 Dec. 2017 9:19 am, "Antoine Pitrou" <<a href="mailto:solipsis@pitrou.net">solipsis@pitrou.net</a>> wrote:<br type="attribution"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
Hello,<br>
<br>
After debugging a crash on AppVeyor for a submitter's PR<br>
(see <a href="https://github.com/python/cpython/pull/4611" rel="noreferrer" target="_blank">https://github.com/python/<wbr>cpython/pull/4611</a> ), I came to the<br>
following diagnosis: converting the "atexit" module (which is a<br>
built-in C extension) to PEP 489 multiphase initialization can lead to<br>
its m_traverse function (and presumably also m_clear and m_free) to be<br>
called while not module state is yet registered: that is,<br>
`PyModule_GetState(self)` when called from m_traverse returns NULL!<br>
<br>
Is that an expected or known subtlety?<br></blockquote></div></div></div><div dir="auto"><br></div><div dir="auto">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.</div><div dir="auto"><br></div><div dir="auto">Cheers,</div><div dir="auto">Nick.</div></div>