summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2016-08-18 16:13:10 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2016-08-18 16:13:10 (GMT)
commiteec9331b207cf7def6f04156d00a8479d1630dd3 (patch)
treece654c4b01d19f6b2bb1a3a05f961c07534e64c8 /Lib/test
parent54005afeeebddbd5b211307b743b591a4cdb7750 (diff)
downloadcpython-eec9331b207cf7def6f04156d00a8479d1630dd3.zip
cpython-eec9331b207cf7def6f04156d00a8479d1630dd3.tar.gz
cpython-eec9331b207cf7def6f04156d00a8479d1630dd3.tar.bz2
Fix SystemError in "raise" statement
Issue #27558: Fix a SystemError in the implementation of "raise" statement. In a brand new thread, raise a RuntimeError since there is no active exception to reraise. Patch written by Xiang Zhang.
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_threading.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/Lib/test/test_threading.py b/Lib/test/test_threading.py
index 1c9c1ea..b630509 100644
--- a/Lib/test/test_threading.py
+++ b/Lib/test/test_threading.py
@@ -1043,6 +1043,24 @@ class ThreadingExceptionTests(BaseTestCase):
self.assertEqual(out, b'')
self.assertNotIn("Unhandled exception", err.decode())
+ def test_bare_raise_in_brand_new_thread(self):
+ def bare_raise():
+ raise
+
+ class Issue27558(threading.Thread):
+ exc = None
+
+ def run(self):
+ try:
+ bare_raise()
+ except Exception as exc:
+ self.exc = exc
+
+ thread = Issue27558()
+ thread.start()
+ thread.join()
+ self.assertIsNotNone(thread.exc)
+ self.assertIsInstance(thread.exc, RuntimeError)
class TimerTests(BaseTestCase):