Skip to content

Commit e1b1b1b

Browse files
committed
Disable "Move Subinterpreter" test on free-threaded Python 3.14+
This test hangs in Py_EndInterpreter() when the subinterpreter is destroyed from a different thread than it was created on. The hang was observed: - Intermittently on macOS with Python 3.14.0t - Predictably on macOS, Ubuntu, and Windows with Python 3.14.1t and 3.14.2t Root cause analysis points to an interaction between pybind11's subinterpreter creation code and CPython's free-threaded runtime, specifically around PyThreadState_Swap() after PyThreadState_DeleteCurrent(). See detailed analysis: #5933
1 parent 21d0dc5 commit e1b1b1b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

tests/test_with_catch/test_subinterpreter.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,11 @@ TEST_CASE("Single Subinterpreter") {
9090
unsafe_reset_internals_for_single_interpreter();
9191
}
9292

93-
# if PY_VERSION_HEX >= 0x030D0000
93+
// "Move Subinterpreter" test is disabled on free-threaded Python 3.14+ due to a hang
94+
// in Py_EndInterpreter() when the subinterpreter is destroyed from a different thread
95+
// than it was created on. See: https://github.com/pybind/pybind11/pull/5933
96+
# if PY_VERSION_HEX >= 0x030D0000 \
97+
&& !(PY_VERSION_HEX >= 0x030E0000 && defined(Py_GIL_DISABLED))
9498
TEST_CASE("Move Subinterpreter") {
9599
std::unique_ptr<py::subinterpreter> sub(new py::subinterpreter(py::subinterpreter::create()));
96100

0 commit comments

Comments
 (0)