From 80e4dbea0ebbc7fa6a25c83c854414bac11d6a15 Mon Sep 17 00:00:00 2001 From: Yury Selivanov Date: Sat, 9 May 2015 14:04:17 -0400 Subject: [PATCH] Issue 22906: Increment refcount after PyException_SetContext --- Objects/genobject.c | 1 + 1 file changed, 1 insertion(+) diff --git a/Objects/genobject.c b/Objects/genobject.c index 5ae8512f540..149e545ec06 100644 --- a/Objects/genobject.c +++ b/Objects/genobject.c @@ -151,6 +151,7 @@ gen_send_ex(PyGenObject *gen, PyObject *arg, int exc) PyErr_NormalizeException(&exc, &val2, &tb); PyException_SetCause(val2, val); PyException_SetContext(val2, val); + Py_INCREF(val); PyErr_Restore(exc, val2, tb); } }