From eec9331b207cf7def6f04156d00a8479d1630dd3 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Thu, 18 Aug 2016 18:13:10 +0200 Subject: 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. --- Python/ceval.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Python') diff --git a/Python/ceval.c b/Python/ceval.c index c632488ec2..8e396fd2bc 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -4123,7 +4123,7 @@ do_raise(PyObject *exc, PyObject *cause) 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; -- cgit v1.2.1