#Issue 29376
self.assertTrue(threading._active[tid].is_alive())
self.assertRegex(repr(threading._active[tid]), '_DummyThread')
+
+ # Issue gh-106236:
+ with self.assertRaises(RuntimeError):
+ threading._active[tid].join()
+ threading._active[tid]._started.clear()
+ with self.assertRaises(RuntimeError):
+ threading._active[tid].is_alive()
+
del threading._active[tid]
# PyThreadState_SetAsyncExc() is a CPython-only gimmick, not (currently)
pass
def is_alive(self):
- assert not self._is_stopped and self._started.is_set()
- return True
+ if not self._is_stopped and self._started.is_set():
+ return True
+ raise RuntimeError("thread is not alive")
def join(self, timeout=None):
- assert False, "cannot join a dummy thread"
+ raise RuntimeError("cannot join a dummy thread")
# Global API functions