File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1043,6 +1043,24 @@ def run():
10431043 self .assertEqual (out , b'' )
10441044 self .assertNotIn ("Unhandled exception" , err .decode ())
10451045
1046+ def test_bare_raise_in_brand_new_thread (self ):
1047+ def bare_raise ():
1048+ raise
1049+
1050+ class Issue27558 (threading .Thread ):
1051+ exc = None
1052+
1053+ def run (self ):
1054+ try :
1055+ bare_raise ()
1056+ except Exception as exc :
1057+ self .exc = exc
1058+
1059+ thread = Issue27558 ()
1060+ thread .start ()
1061+ thread .join ()
1062+ self .assertIsNotNone (thread .exc )
1063+ self .assertIsInstance (thread .exc , RuntimeError )
10461064
10471065class TimerTests (BaseTestCase ):
10481066
Original file line number Diff line number Diff line change @@ -10,12 +10,17 @@ What's New in Python 3.6.0 beta 1
1010Core and Builtins
1111-----------------
1212
13+ - Issue #27558: Fix a SystemError in the implementation of "raise" statement.
14+ In a brand new thread, raise a RuntimeError since there is no active
15+ exception to reraise. Patch written by Xiang Zhang.
16+
1317Library
1418-------
1519
1620- Issue #9998: On Linux, ctypes.util.find_library now looks in LD_LIBRARY_PATH
1721 for shared libraries.
1822
23+
1924What's New in Python 3.6.0 alpha 4
2025==================================
2126
Original file line number Diff line number Diff line change @@ -4154,7 +4154,7 @@ do_raise(PyObject *exc, PyObject *cause)
41544154 type = tstate -> exc_type ;
41554155 value = tstate -> exc_value ;
41564156 tb = tstate -> exc_traceback ;
4157- if (type == Py_None ) {
4157+ if (type == Py_None || type == NULL ) {
41584158 PyErr_SetString (PyExc_RuntimeError ,
41594159 "No active exception to reraise" );
41604160 return 0 ;
You can’t perform that action at this time.
0 commit comments