Mercurial > cpython-lru_cache-weakref
diff Python/import.c @ 84729:92e27be3dd62
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:52:18 +0200 |
| parents | 6bd01a59762a 80a5c2c2fb8a |
| children | 79e2f5bbc30c |
line wrap: on
line diff
--- a/Python/import.c Sat Jul 20 14:48:21 2013 +0200 +++ b/Python/import.c Sat Jul 20 14:52:18 2013 +0200 @@ -585,7 +585,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) {
