diff options
Diffstat (limited to 'Python/import.c')
| -rw-r--r-- | Python/import.c | 5 | 
1 files changed, 4 insertions, 1 deletions
diff --git a/Python/import.c b/Python/import.c index a1c0aee..c6222ec 100644 --- a/Python/import.c +++ b/Python/import.c @@ -585,7 +585,10 @@ _PyImport_FindExtensionObject(PyObject *name, PyObject *filename)          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) {  | 
