diff options
author | Irit Katriel <1055913+iritkatriel@users.noreply.github.com> | 2023-02-20 22:16:09 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-20 22:16:09 (GMT) |
commit | 022b44f2546c44183e4df7b67e3e64502fae9143 (patch) | |
tree | 64b46d13946bbf8704dd82d3d63a3297e96a6cfe /Lib/test/test_threading.py | |
parent | 4d3bc89a3f54c4f09756a9b644b3912bf54191a7 (diff) | |
download | cpython-022b44f2546c44183e4df7b67e3e64502fae9143.zip cpython-022b44f2546c44183e4df7b67e3e64502fae9143.tar.gz cpython-022b44f2546c44183e4df7b67e3e64502fae9143.tar.bz2 |
gh-102056: Fix a few bugs in error handling of exception printing code (#102078)
Diffstat (limited to 'Lib/test/test_threading.py')
-rw-r--r-- | Lib/test/test_threading.py | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/Lib/test/test_threading.py b/Lib/test/test_threading.py index 7fea2d3..a39a267 100644 --- a/Lib/test/test_threading.py +++ b/Lib/test/test_threading.py @@ -1523,6 +1523,37 @@ class ThreadingExceptionTests(BaseTestCase): self.assertEqual(out, b'') self.assertNotIn("Unhandled exception", err.decode()) + def test_print_exception_gh_102056(self): + # This used to crash. See gh-102056. + script = r"""if True: + import time + import threading + import _thread + + def f(): + try: + f() + except RecursionError: + f() + + def g(): + try: + raise ValueError() + except* ValueError: + f() + + def h(): + time.sleep(1) + _thread.interrupt_main() + + t = threading.Thread(target=h) + t.start() + g() + t.join() + """ + + assert_python_failure("-c", script) + def test_bare_raise_in_brand_new_thread(self): def bare_raise(): raise |