From 0f7dbf731a9f2b9422fa6e08188edf654f2848a9 Mon Sep 17 00:00:00 2001 From: Neal Norwitz Date: Sat, 12 Aug 2006 03:17:41 +0000 Subject: PyModule_GetDict() can fail, produce fatal errors if this happens on startup. Klocwork #298-299. --- Python/pythonrun.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Python/pythonrun.c b/Python/pythonrun.c index 88fd67c..37feeca 100644 --- a/Python/pythonrun.c +++ b/Python/pythonrun.c @@ -203,12 +203,16 @@ Py_InitializeEx(int install_sigs) 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()); -- cgit v0.12