mirror of https://github.com/python/cpython
Issue #18408: Fix PyErr_SetImportError(), handle PyDict_SetItemString() failure
This commit is contained in:
parent
8e54b1c448
commit
479054bca7
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue