Mercurial > cpython-lru_cache-weakref
diff Python/pythonrun.c @ 39970:54d177ede883 2.4
[Backport r51231 | neal.norwitz]
PyModule_GetDict() can fail, produce fatal errors if this happens on startup.
Klocwork #298-299.
| author | Andrew M. Kuchling <amk@amk.ca> |
|---|---|
| date | Tue, 03 Oct 2006 19:08:48 +0000 |
| parents | bc4fbbb2db30 |
| children | 8c83fd79cee5 |
line wrap: on
line diff
--- a/Python/pythonrun.c Tue Oct 03 19:07:06 2006 +0000 +++ b/Python/pythonrun.c Tue Oct 03 19:08:48 2006 +0000 @@ -185,12 +185,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());
