Issue #22906: Do incref before SetCause/SetContext

This commit is contained in:
Yury Selivanov 2015-05-10 15:09:46 -04:00
parent 582d3fb1a5
commit 18c30a29f8
1 changed files with 1 additions and 1 deletions

View File

@ -149,9 +149,9 @@ gen_send_ex(PyGenObject *gen, PyObject *arg, int exc)
"generator raised StopIteration"); "generator raised StopIteration");
PyErr_Fetch(&exc, &val2, &tb); PyErr_Fetch(&exc, &val2, &tb);
PyErr_NormalizeException(&exc, &val2, &tb); PyErr_NormalizeException(&exc, &val2, &tb);
Py_INCREF(val);
PyException_SetCause(val2, val); PyException_SetCause(val2, val);
PyException_SetContext(val2, val); PyException_SetContext(val2, val);
Py_INCREF(val);
PyErr_Restore(exc, val2, tb); PyErr_Restore(exc, val2, tb);
} }
} }