Skip to content

Commit 4093ea6

Browse files
committed
gh-151518: Restrict STW test pauses to free-threaded builds
STW is a no-op in GIL builds. Avoid waiting in the helper there, since WASI cannot perform the blocking futex operation.
1 parent 15c4b6d commit 4093ea6

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

‎Modules/_testinternalcapi.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,7 @@ get_stack_margin(PyObject *self, PyObject *Py_UNUSED(args))
212212
static PyObject *
213213
test_stop_the_world(PyObject *self, PyObject *Py_UNUSED(args))
214214
{
215+
#ifdef Py_GIL_DISABLED
215216
PyInterpreterState *interp = _PyInterpreterState_GET();
216217
// Request consecutive pauses without running Python code between them.
217218
for (int i = 0; i < 100; i++) {
@@ -221,6 +222,7 @@ test_stop_the_world(PyObject *self, PyObject *Py_UNUSED(args))
221222
PyEvent_WaitTimed(&event, 10 * 1000 * 1000, /*detach=*/0);
222223
_PyEval_StartTheWorld(interp);
223224
}
225+
#endif
224226
Py_RETURN_NONE;
225227
}
226228

0 commit comments

Comments
 (0)