From: Tim Peters Date: Wed, 12 Apr 2006 06:44:36 +0000 (+0000) Subject: gen_throw(): The caller doesn't own PyArg_ParseTuple() X-Git-Tag: v2.5a2~311 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a5a80cb4a46b031641f56493dbf4821d4f3560b0;p=python gen_throw(): The caller doesn't own PyArg_ParseTuple() "O" arguments, so must not decref them. This accounts for why running test_contextlib.test_main() in a loop eventually tried to deallocate Py_None. --- diff --git a/Objects/genobject.c b/Objects/genobject.c index a3eae6a6b9..7cec29022c 100644 --- a/Objects/genobject.c +++ b/Objects/genobject.c @@ -217,10 +217,8 @@ gen_throw(PyGenObject *gen, PyObject *args) /* First, check the traceback argument, replacing None with NULL. */ - if (tb == Py_None) { - Py_DECREF(tb); + if (tb == Py_None) tb = NULL; - } else if (tb != NULL && !PyTraceBack_Check(tb)) { PyErr_SetString(PyExc_TypeError, "throw() third argument must be a traceback object");