mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
gh-102056: Fix a few bugs in error handling of exception printing code (#102078)
This commit is contained in:
parent
4d3bc89a3f
commit
022b44f254
3 changed files with 48 additions and 7 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue