changeset: 95940:787cc3d1d3af parent: 95935:f7cc54086cd2 user: Yury Selivanov date: Sun May 10 15:09:46 2015 -0400 files: Objects/genobject.c description: Issue #22906: Do incref before SetCause/SetContext diff -r f7cc54086cd2 -r 787cc3d1d3af Objects/genobject.c --- a/Objects/genobject.c Sat May 09 11:37:23 2015 -0700 +++ b/Objects/genobject.c Sun May 10 15:09:46 2015 -0400 @@ -149,9 +149,9 @@ "generator raised StopIteration"); PyErr_Fetch(&exc, &val2, &tb); PyErr_NormalizeException(&exc, &val2, &tb); + Py_INCREF(val); PyException_SetCause(val2, val); PyException_SetContext(val2, val); - Py_INCREF(val); PyErr_Restore(exc, val2, tb); } }