Kaydet (Commit) f3a9faba authored tarafından Xiang Zhang's avatar Xiang Zhang Kaydeden (comit) GitHub

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

üst 1f5639c7
...@@ -170,6 +170,9 @@ class ThreadTests(BaseTestCase): ...@@ -170,6 +170,9 @@ class ThreadTests(BaseTestCase):
mutex.acquire() mutex.acquire()
self.assertIn(tid, threading._active) self.assertIn(tid, threading._active)
self.assertIsInstance(threading._active[tid], threading._DummyThread) 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] del threading._active[tid]
# PyThreadState_SetAsyncExc() is a CPython-only gimmick, not (currently) # PyThreadState_SetAsyncExc() is a CPython-only gimmick, not (currently)
......
...@@ -1217,6 +1217,10 @@ class _DummyThread(Thread): ...@@ -1217,6 +1217,10 @@ class _DummyThread(Thread):
def _stop(self): def _stop(self):
pass pass
def is_alive(self):
assert not self._is_stopped and self._started.is_set()
return True
def join(self, timeout=None): def join(self, timeout=None):
assert False, "cannot join a dummy thread" assert False, "cannot join a dummy thread"
......
...@@ -249,6 +249,8 @@ Extension Modules ...@@ -249,6 +249,8 @@ Extension Modules
Library Library
------- -------
- bpo-29376: Fix assertion error in threading._DummyThread.is_alive().
- bpo-28624: Add a test that checks that cwd parameter of Popen() accepts - bpo-28624: Add a test that checks that cwd parameter of Popen() accepts
PathLike objects. Patch by Sayan Chowdhury. PathLike objects. Patch by Sayan Chowdhury.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment