You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG]: Segmentation fault on Python finalization with PYBIND11_HAS_SUBINTERPRETER_SUPPORT on Python 3.12d #5687
While testing with Python 3.12 with Py_DEBUG enabled, a segmentation fault will be raised on Python finalization:
Fatal Python error: _PyInterpreterState_GET: the function must be called with the GIL held, after Python initialization and before Python finalization, but the GIL is released (the current Python thread state is NULL)
changed the title [-][BUG]: Segmentation fault on module initialization with `PYBIND11_HAS_SUBINTERPRETER_SUPPORT` on Python 3.12[/-][+][BUG]: Segmentation fault on module initialization with `PYBIND11_HAS_SUBINTERPRETER_SUPPORT` on Python 3.12d[/+]on May 23, 2025
changed the title [-][BUG]: Segmentation fault on module initialization with `PYBIND11_HAS_SUBINTERPRETER_SUPPORT` on Python 3.12d[/-][+][BUG]: Segmentation fault on Python finalization with `PYBIND11_HAS_SUBINTERPRETER_SUPPORT` on Python 3.12d[/+]on May 23, 2025
Ah, I think this is caused by the multiphase init changes and not (directly) by subinterpreter support. Are you able to try this one-line change and see if it fixes the issue?
Activity
[-][BUG]: Segmentation fault on module initialization with `PYBIND11_HAS_SUBINTERPRETER_SUPPORT` on Python 3.12[/-][+][BUG]: Segmentation fault on module initialization with `PYBIND11_HAS_SUBINTERPRETER_SUPPORT` on Python 3.12d[/+][-][BUG]: Segmentation fault on module initialization with `PYBIND11_HAS_SUBINTERPRETER_SUPPORT` on Python 3.12d[/-][+][BUG]: Segmentation fault on Python finalization with `PYBIND11_HAS_SUBINTERPRETER_SUPPORT` on Python 3.12d[/+]b-pass commentedon May 23, 2025
Ah, I think this is caused by the multiphase init changes and not (directly) by subinterpreter support. Are you able to try this one-line change and see if it fixes the issue?
If this works for you I will make a PR for it.
XuehaiPan commentedon May 26, 2025
Fixed on latest HEAD.