Issue #23960: Cleanup args and kwargs on error in PyErr_SetImportError

Patch by Ofer Schwarz.
This commit is contained in:
Berker Peksag 2016-05-01 09:06:36 +03:00
parent 8988ebf2a7
commit ec766d3c15
1 changed files with 3 additions and 3 deletions

View File

@ -727,9 +727,9 @@ PyErr_SetImportError(PyObject *msg, PyObject *name, PyObject *path)
PyTuple_SET_ITEM(args, 0, msg);
if (PyDict_SetItemString(kwargs, "name", name) < 0)
return NULL;
goto done;
if (PyDict_SetItemString(kwargs, "path", path) < 0)
return NULL;
goto done;
error = PyObject_Call(PyExc_ImportError, args, kwargs);
if (error != NULL) {
@ -737,9 +737,9 @@ PyErr_SetImportError(PyObject *msg, PyObject *name, PyObject *path)
Py_DECREF(error);
}
done:
Py_DECREF(args);
Py_DECREF(kwargs);
return NULL;
}