Closed
Description
Required prerequisites
- Make sure you've read the documentation. Your issue may be addressed there.
- Search the issue tracker and Discussions to verify that this hasn't already been reported. +1 or comment there if it has.
- Consider asking first in the Gitter chat room or in a Discussion.
What version (or hash if on master) of pybind11 are you using?
master @ 98bd78f
Problem description
Building with Python 3.12+ will automatically enable subinterpreter support after #5564.
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 isNULL
)
- Python 3.12d on Linux: https://github.com/metaopt/optree/actions/runs/15216857124/job/42804275481?pr=216#step:15:62
- Python 3.12d on macOS: https://github.com/metaopt/optree/actions/runs/15216857124/job/42804275470?pr=216#step:15:56
- Python 3.12d on Windows: https://github.com/metaopt/optree/actions/runs/15216857124/job/42804275480?pr=216#step:15:191
Reproducible example code
Is this a regression? Put the last known working version here if it is.
Not a regression