diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2013-07-17 19:54:25 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2013-07-17 19:54:25 (GMT) |
commit | 479054bca7722daa2e6b62da474fd49c8fafbbee (patch) | |
tree | cd9b8cc9eb4e3a279fdc1fd54fd0974c58d8bdba /Python | |
parent | 8e54b1c4486527075ffbb85e8c3db923aedb5e54 (diff) | |
download | cpython-479054bca7722daa2e6b62da474fd49c8fafbbee.zip cpython-479054bca7722daa2e6b62da474fd49c8fafbbee.tar.gz cpython-479054bca7722daa2e6b62da474fd49c8fafbbee.tar.bz2 |
Issue #18408: Fix PyErr_SetImportError(), handle PyDict_SetItemString() failure
Diffstat (limited to 'Python')
-rw-r--r-- | Python/errors.c | 7 |
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) { |