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.
This commit is contained in:
Victor Stinner 2016-08-18 18:13:10 +02:00
parent 54005afeee
commit eec9331b20
3 changed files with 23 additions and 1 deletions

View file

@ -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;