From fec767442089180f5642c4f57261b6f3a05dcc35 Mon Sep 17 00:00:00 2001 From: "Andrew M. Kuchling" Date: Tue, 3 Oct 2006 19:08:48 +0000 Subject: [Backport r51231 | neal.norwitz] 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 e093dc5..9ef1fea 100644 --- a/Python/pythonrun.c +++ b/Python/pythonrun.c @@ -185,12 +185,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