Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
3 changes: 3 additions & 0 deletions Lib/test/test_threading.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,9 @@ def f(mutex):
mutex.acquire()
self.assertIn(tid, threading._active)
self.assertIsInstance(threading._active[tid], threading._DummyThread)
#Issue 29376
self.assertTrue(threading._active[tid].is_alive())
self.assertRegex(repr(threading._active[tid]), '_DummyThread')
del threading._active[tid]

# PyThreadState_SetAsyncExc() is a CPython-only gimmick, not (currently)
Expand Down
4 changes: 4 additions & 0 deletions Lib/threading.py
Original file line number Diff line number Diff line change
Expand Up @@ -1217,6 +1217,10 @@ def __init__(self):
def _stop(self):
pass

def is_alive(self):
assert not self._is_stopped and self._started.is_set()
return True

def join(self, timeout=None):
assert False, "cannot join a dummy thread"

Expand Down
2 changes: 2 additions & 0 deletions Misc/NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,8 @@ Extension Modules
Library
-------

- bpo-29376: Fix assertion error in threading._DummyThread.is_alive().

- bpo-29532: Altering a kwarg dictionary passed to functools.partial()
no longer affects a partial object after creation.

Expand Down