]> granicus.if.org Git - python/commitdiff
gen_throw(): The caller doesn't own PyArg_ParseTuple()
authorTim Peters <tim.peters@gmail.com>
Wed, 12 Apr 2006 06:44:36 +0000 (06:44 +0000)
committerTim Peters <tim.peters@gmail.com>
Wed, 12 Apr 2006 06:44:36 +0000 (06:44 +0000)
"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

index a3eae6a6b989676528f8867e016f976ddd277981..7cec29022c36cea670e64a76b2035810ef15516a 100644 (file)
@@ -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");