Mercurial > cpython-lru_cache-weakref
comparison 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 |
comparison
equal
deleted
inserted
replaced
| 84693:479af6ca3a3c | 84694:573f7d485ce8 |
|---|---|
| 653 path = Py_None; | 653 path = Py_None; |
| 654 } | 654 } |
| 655 | 655 |
| 656 Py_INCREF(msg); | 656 Py_INCREF(msg); |
| 657 PyTuple_SET_ITEM(args, 0, msg); | 657 PyTuple_SET_ITEM(args, 0, msg); |
| 658 PyDict_SetItemString(kwargs, "name", name); | 658 |
| 659 PyDict_SetItemString(kwargs, "path", path); | 659 if (PyDict_SetItemString(kwargs, "name", name) < 0) |
| 660 return NULL; | |
| 661 if (PyDict_SetItemString(kwargs, "path", path) < 0) | |
| 662 return NULL; | |
| 660 | 663 |
| 661 error = PyObject_Call(PyExc_ImportError, args, kwargs); | 664 error = PyObject_Call(PyExc_ImportError, args, kwargs); |
| 662 if (error != NULL) { | 665 if (error != NULL) { |
| 663 PyErr_SetObject((PyObject *)Py_TYPE(error), error); | 666 PyErr_SetObject((PyObject *)Py_TYPE(error), error); |
| 664 Py_DECREF(error); | 667 Py_DECREF(error); |
