mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
gh-106236: Replace assert
with raise RuntimeError
in threading.py
(#106237)
Replace `assert` with `raise ` in `threading.py` so that -OO does not alter _DummyThread behavior.
This commit is contained in:
parent
dd1884dc5d
commit
e4b88c1e4a
3 changed files with 14 additions and 3 deletions
|
@ -1451,11 +1451,12 @@ class _DummyThread(Thread):
|
|||
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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue