summaryrefslogtreecommitdiffstats
path: root/Python/errors.c
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2013-07-17 19:54:25 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2013-07-17 19:54:25 (GMT)
commit479054bca7722daa2e6b62da474fd49c8fafbbee (patch)
treecd9b8cc9eb4e3a279fdc1fd54fd0974c58d8bdba /Python/errors.c
parent8e54b1c4486527075ffbb85e8c3db923aedb5e54 (diff)
downloadcpython-479054bca7722daa2e6b62da474fd49c8fafbbee.zip
cpython-479054bca7722daa2e6b62da474fd49c8fafbbee.tar.gz
cpython-479054bca7722daa2e6b62da474fd49c8fafbbee.tar.bz2
Issue #18408: Fix PyErr_SetImportError(), handle PyDict_SetItemString() failure
Diffstat (limited to 'Python/errors.c')
-rw-r--r--Python/errors.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/Python/errors.c b/Python/errors.c
index 53dd9a9..c693b78 100644
--- a/Python/errors.c
+++ b/Python/errors.c
@@ -655,8 +655,11 @@ PyErr_SetImportError(PyObject *msg, PyObject *name, PyObject *path)
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) {