Skip to content

Stop the world doesn't set paused threads states to _Py_THREAD_SUSPENDED #116396

@colesbury

Description

@colesbury

Bug report

The detach_thread function should set the state to the detached_state argument, but currently that argument is unused.

cpython/Python/pystate.c

Lines 1925 to 1941 in d2f1b0e

static void
detach_thread(PyThreadState *tstate, int detached_state)
{
// XXX assert(tstate_is_alive(tstate) && tstate_is_bound(tstate));
assert(tstate->state == _Py_THREAD_ATTACHED);
assert(tstate == current_fast_get());
if (tstate->critical_section != 0) {
_PyCriticalSection_SuspendAll(tstate);
}
#ifdef Py_GIL_DISABLED
_Py_qsbr_detach(((_PyThreadStateImpl *)tstate)->qsbr);
#endif
tstate_deactivate(tstate);
tstate_set_detached(tstate);
current_fast_clear(&_PyRuntime);
_PyEval_ReleaseLock(tstate->interp, tstate);
}

Linked PRs

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions