[Python-checkins] cpython: Issue #18408: Fix PyErr_SetImportError(), handle PyDict_SetItemString() failure
victor.stinner
python-checkins at python.org
Wed Jul 17 22:11:54 CEST 2013
http://hg.python.org/cpython/rev/573f7d485ce8
changeset: 84694:573f7d485ce8
user: Victor Stinner <victor.stinner at gmail.com>
date: Wed Jul 17 21:54:25 2013 +0200
summary:
Issue #18408: Fix PyErr_SetImportError(), handle PyDict_SetItemString() failure
files:
Python/errors.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/Python/errors.c b/Python/errors.c
--- a/Python/errors.c
+++ b/Python/errors.c
@@ -655,8 +655,11 @@
Py_INCREF(msg);
PyTuple_SET_ITEM(args, 0, msg);
- PyDict_SetItemString(kwargs, "name", name);
- PyDict_SetItemString(kwargs, "path", path);
+
+ if (PyDict_SetItemString(kwargs, "name", name) < 0)
+ return NULL;
+ if (PyDict_SetItemString(kwargs, "path", path) < 0)
+ return NULL;
error = PyObject_Call(PyExc_ImportError, args, kwargs);
if (error != NULL) {
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list