Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Fix :obj:`threading.Thread.is_alive` to remain ``True`` until the underlying OS
thread is fully cleaned up. This avoids false negatives in edge cases
involving thread monitoring or premature :obj:`threading.Thread.is_alive` calls.
4 changes: 4 additions & 0 deletions Modules/_threadmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -711,6 +711,10 @@ PyThreadHandleObject_is_done(PyObject *op, PyObject *Py_UNUSED(dummy))
{
PyThreadHandleObject *self = PyThreadHandleObject_CAST(op);
if (_PyEvent_IsSet(&self->handle->thread_is_exiting)) {
if (_PyOnceFlag_CallOnce(&self->handle->once, join_thread, self->handle) == -1) {
PyErr_SetString(PyExc_RuntimeError, "failed to join thread");
return NULL;
}
Py_RETURN_TRUE;
}
else {
Expand Down
Loading