summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorBerker Peksag <berker.peksag@gmail.com>2016-05-01 06:06:57 (GMT)
committerBerker Peksag <berker.peksag@gmail.com>2016-05-01 06:06:57 (GMT)
commitaa9d36970758ab4076e1625123bd2d8eb55cbe8a (patch)
tree37867a5786ce469cf0ffae1f513f9b3b3a63bd52 /Python
parentf1e2671fdf88fce8a367ee63aba4a02352bd94d6 (diff)
parentec766d3c159e0526db641505dbdf0a7f4271e5e4 (diff)
downloadcpython-aa9d36970758ab4076e1625123bd2d8eb55cbe8a.zip
cpython-aa9d36970758ab4076e1625123bd2d8eb55cbe8a.tar.gz
cpython-aa9d36970758ab4076e1625123bd2d8eb55cbe8a.tar.bz2
Issue #23960: Cleanup args and kwargs on error in PyErr_SetImportError
Patch by Ofer Schwarz.
Diffstat (limited to 'Python')
-rw-r--r--Python/errors.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/Python/errors.c b/Python/errors.c
index 47d7c4b..e151cab 100644
--- a/Python/errors.c
+++ b/Python/errors.c
@@ -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;
}