diff -r bff31254a0f0 Lib/test/test_raise.py --- a/Lib/test/test_raise.py Sat Jul 16 16:13:51 2016 -0700 +++ b/Lib/test/test_raise.py Mon Jul 18 21:29:53 2016 +0800 @@ -3,6 +3,7 @@ """Tests for the raise statement.""" +from multiprocessing.pool import ThreadPool from test import support import re import sys @@ -147,6 +148,14 @@ except AssertionError as e: self.assertEqual(str(e), "(3,)") + @support.reap_threads + def test_reraise_in_new_thread(self): + # issue #27558 + def reraise(): + raise + pool = ThreadPool(processes=1) + self.assertRaises(RuntimeError, pool.apply_async(reraise).get) + pool.close() class TestCause(unittest.TestCase): diff -r bff31254a0f0 Python/ceval.c --- a/Python/ceval.c Sat Jul 16 16:13:51 2016 -0700 +++ b/Python/ceval.c Mon Jul 18 21:29:53 2016 +0800 @@ -4141,7 +4141,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;