Mercurial > cpython-lru_cache-weakref
diff Python/import.c @ 84728:80a5c2c2fb8a 3.3
Add missing check of PyDict_SetItem()'s return value in _PyImport_FindExtensionObject()
CID 486649
| author | Christian Heimes <christian@cheimes.de> |
|---|---|
| date | Sat, 20 Jul 2013 14:51:53 +0200 |
| parents | 08ce30768003 |
| children | 92e27be3dd62 |
line wrap: on
line diff
--- a/Python/import.c Sat Jul 20 14:48:10 2013 +0200 +++ b/Python/import.c Sat Jul 20 14:51:53 2013 +0200 @@ -553,7 +553,10 @@ mod = def->m_base.m_init(); if (mod == NULL) return NULL; - PyDict_SetItem(PyImport_GetModuleDict(), name, mod); + if (PyDict_SetItem(PyImport_GetModuleDict(), name, mod) == -1) { + Py_DECREF(mod); + return NULL; + } Py_DECREF(mod); } if (_PyState_AddModule(mod, def) < 0) {
