diff -r 617104a6b759 Lib/test/test_threading.py --- a/Lib/test/test_threading.py Wed Aug 17 19:56:17 2016 -0400 +++ b/Lib/test/test_threading.py Thu Aug 18 12:12:35 2016 +0800 @@ -1043,6 +1043,24 @@ self.assertEqual(out, b'') self.assertNotIn("Unhandled exception", err.decode()) + def test_bare_raise_in_brand_new_thread(self): + def foo(): + raise + + class Issue27558(threading.Thread): + exc = None + + def run(self): + try: + foo() + 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): diff -r 617104a6b759 Python/ceval.c --- a/Python/ceval.c Wed Aug 17 19:56:17 2016 -0400 +++ b/Python/ceval.c Thu Aug 18 12:12:35 2016 +0800 @@ -4154,7 +4154,7 @@ type = tstate->exc_type; value = tstate->exc_value; tb = tstate->exc_traceback; - if (type == Py_None) { + if (type == Py_None || type == NULL) { PyErr_SetString(PyExc_RuntimeError, "No active exception to reraise"); return 0;