Skip to content

[BUG]: Segmentation fault on Python finalization with PYBIND11_HAS_SUBINTERPRETER_SUPPORT on Python 3.12d #5687

Description

@XuehaiPan

Required prerequisites

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 is NULL)

Reproducible example code


Is this a regression? Put the last known working version here if it is.

Not a regression

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    triageNew bug, unverified

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions