summaryrefslogtreecommitdiffstats
path: root/Python/pythonrun.c
diff options
context:
space:
mode:
authorNeal Norwitz <nnorwitz@gmail.com>2006-08-12 03:17:41 (GMT)
committerNeal Norwitz <nnorwitz@gmail.com>2006-08-12 03:17:41 (GMT)
commit0f7dbf731a9f2b9422fa6e08188edf654f2848a9 (patch)
treeea67ba913d57472df77bdef9c8120330c1685a76 /Python/pythonrun.c
parentb88cfad3181ba2eb6537edeb9a7d067970178d69 (diff)
downloadcpython-0f7dbf731a9f2b9422fa6e08188edf654f2848a9.zip
cpython-0f7dbf731a9f2b9422fa6e08188edf654f2848a9.tar.gz
cpython-0f7dbf731a9f2b9422fa6e08188edf654f2848a9.tar.bz2
PyModule_GetDict() can fail, produce fatal errors if this happens on startup.
Klocwork #298-299.
Diffstat (limited to 'Python/pythonrun.c')
-rw-r--r--Python/pythonrun.c4
1 files changed, 4 insertions, 0 deletions
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());