Mercurial > cpython-lru_cache-weakref
diff Python/pythonrun.c @ 39458:deb748f33c1d legacy-trunk
PyModule_GetDict() can fail, produce fatal errors if this happens on startup.
Klocwork #298-299.
| author | Neal Norwitz <nnorwitz@gmail.com> |
|---|---|
| date | Sat, 12 Aug 2006 03:17:41 +0000 |
| parents | ed65765eb679 |
| children | 9dee81dcb9b4 |
line wrap: on
line diff
--- a/Python/pythonrun.c Sat Aug 12 03:16:54 2006 +0000 +++ b/Python/pythonrun.c Sat Aug 12 03:17:41 2006 +0000 @@ -203,12 +203,16 @@ if (bimod == NULL) Py_FatalError("Py_Initialize: can't initialize __builtin__"); interp->builtins = PyModule_GetDict(bimod); + if (interp->builtins == NULL) + Py_FatalError("Py_Initialize: can't initialize builtins dict"); Py_INCREF(interp->builtins); sysmod = _PySys_Init(); if (sysmod == NULL) Py_FatalError("Py_Initialize: can't initialize sys"); interp->sysdict = PyModule_GetDict(sysmod); + if (interp->sysdict == NULL) + Py_FatalError("Py_Initialize: can't initialize sys dict"); Py_INCREF(interp->sysdict); _PyImport_FixupExtension("sys", "sys"); PySys_SetPath(Py_GetPath());
