Closed jcrist closed 1 year ago
For additional context, the segfault here:
msgspec
successfully imports then you won't be hit by this issue.msgspec
import (I'm guessing this is due to the faulty memory access being in a region that was already allocated and used previously in this case). In particular, this means that the test suite never segfaults due to this issue, which is how it went uncaught until the conda-forge builds started failing (here).Rather than add a test for this esoteric issue, I've:
I'll cut a new release immediately after merging this.
Thanks
Python 3.12 changed module init slightly (this may actually be a CPython 3.12 bug, it's not 100% clear). Before Python 3.12 the module wouldn't be available via
PyState_FindModule
until it was fully initialized. Now the module is immediately available, but in an invalid state leading to segfaults. The workaround is to manually callPyState_AddModule
to ensure the module is always available.In the long run we should move to using multiphase module init which should avoid this problem entirely.