Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 27, 2017
Merged
Show file tree
Hide file tree
Changes from all 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
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 @@ -1215,6 +1215,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 @@ -32,6 +32,8 @@ Extension Modules
Library
-------

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

- bpo-29110: Fix file object leak in aifc.open() when file is given as a
filesystem path and is not in valid AIFF format. Patch by Anthony Zhang.

Expand Down