diff options
author | Nikita Sobolev <mail@sobolevn.me> | 2023-07-12 21:07:59 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-12 11:07:59 -0700 |
commit | e4b88c1e4ac129b36f99a534387d64f7b8cda8ef (patch) | |
tree | 4a8e0dc10501d120508a2bf2b9f4369420775133 /Lib/test | |
parent | dd1884dc5dc1a540c60e98ea1bc482a51d996564 (diff) | |
download | cpython-e4b88c1e4ac129b36f99a534387d64f7b8cda8ef.tar.gz cpython-e4b88c1e4ac129b36f99a534387d64f7b8cda8ef.zip |
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.
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_threading.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/test/test_threading.py b/Lib/test/test_threading.py index 9e4972ecb64..4a91eef31c4 100644 --- a/Lib/test/test_threading.py +++ b/Lib/test/test_threading.py @@ -251,6 +251,14 @@ class ThreadTests(BaseTestCase): #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) |