Mercurial > cpython-lru_cache-weakref
diff Python/errors.c @ 84694:573f7d485ce8
Issue #18408: Fix PyErr_SetImportError(), handle PyDict_SetItemString() failure
| author | Victor Stinner <victor.stinner@gmail.com> |
|---|---|
| date | Wed, 17 Jul 2013 21:54:25 +0200 |
| parents | a685f4c6e0b6 |
| children | 48a869a39e2d |
line wrap: on
line diff
--- a/Python/errors.c Wed Jul 17 21:53:23 2013 +0200 +++ b/Python/errors.c Wed Jul 17 21:54:25 2013 +0200 @@ -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) {
