mirror of
https://github.com/python/cpython.git
synced 2025-07-28 21:55:21 +00:00
PyModule_GetDict() can fail, produce fatal errors if this happens on startup.
Klocwork #298-299.
This commit is contained in:
parent
b88cfad318
commit
0f7dbf731a
1 changed files with 4 additions and 0 deletions
|
@ -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());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue