[Python-checkins] cpython (3.5): Issue #23960: Cleanup args and kwargs on error in PyErr_SetImportError
berker.peksag
python-checkins at python.org
Sun May 1 02:07:04 EDT 2016
https://hg.python.org/cpython/rev/5871b48f4c2e
changeset: 101195:5871b48f4c2e
branch: 3.5
parent: 101193:db5baad7ad69
user: Berker Peksag <berker.peksag at gmail.com>
date: Sun May 01 09:06:36 2016 +0300
summary:
Issue #23960: Cleanup args and kwargs on error in PyErr_SetImportError
Patch by Ofer Schwarz.
files:
Python/errors.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/Python/errors.c b/Python/errors.c
--- a/Python/errors.c
+++ b/Python/errors.c
@@ -727,9 +727,9 @@
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 @@
Py_DECREF(error);
}
+done:
Py_DECREF(args);
Py_DECREF(kwargs);
-
return NULL;
}
--
Repository URL: https://hg.python.org/cpython
More information about the Python-checkins
mailing list