From a5a80cb4a46b031641f56493dbf4821d4f3560b0 Mon Sep 17 00:00:00 2001 From: Tim Peters Date: Wed, 12 Apr 2006 06:44:36 +0000 Subject: [PATCH] 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. --- Objects/genobject.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) 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"); -- 2.40.0