diff options
| author | Andrew M. Kuchling <amk@amk.ca> | 2006-10-03 19:08:48 (GMT) |
|---|---|---|
| committer | Andrew M. Kuchling <amk@amk.ca> | 2006-10-03 19:08:48 (GMT) |
| commit | fec767442089180f5642c4f57261b6f3a05dcc35 (patch) | |
| tree | 2191e166a29d8830b9c7039561420f31ae217dd2 /Python/pythonrun.c | |
| parent | 59e0e1e39541866b2897c5d1002d49aedf79f393 (diff) | |
| download | cpython-fec767442089180f5642c4f57261b6f3a05dcc35.zip cpython-fec767442089180f5642c4f57261b6f3a05dcc35.tar.gz cpython-fec767442089180f5642c4f57261b6f3a05dcc35.tar.bz2 | |
[Backport r51231 | neal.norwitz]
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.c | 4 |
1 files changed, 4 insertions, 0 deletions
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()); |
