mirror of https://github.com/python/cpython
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.
This commit is contained in:
parent
ee6d23e500
commit
a5a80cb4a4
|
@ -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");
|
||||
|
|
Loading…
Reference in New Issue