bpo-29376: Fix assertion error in threading._DummyThread.is_alive() (GH-330)
This commit is contained in:
parent
7e4897a2fb
commit
4b6c41768a
|
@ -170,6 +170,9 @@ class ThreadTests(BaseTestCase):
|
|||
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)
|
||||
|
|
|
@ -1217,6 +1217,10 @@ class _DummyThread(Thread):
|
|||
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"
|
||||
|
||||
|
|
Loading…
Reference in New Issue