summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorNeal Norwitz <nnorwitz@gmail.com>2006-08-21 20:16:24 (GMT)
committerNeal Norwitz <nnorwitz@gmail.com>2006-08-21 20:16:24 (GMT)
commit0c6ae5bad473c57b3d5b2a3c71b26792e63df14c (patch)
tree8e50ecfa499ae842b56bc0e5250bff71a49c119a /Python
parent4f096d948797cabbe717197faf4d979d68badd0b (diff)
downloadcpython-0c6ae5bad473c57b3d5b2a3c71b26792e63df14c.zip
cpython-0c6ae5bad473c57b3d5b2a3c71b26792e63df14c.tar.gz
cpython-0c6ae5bad473c57b3d5b2a3c71b26792e63df14c.tar.bz2
Handle a few more error conditions.
Klocwork 301 and 302. Will backport.
Diffstat (limited to 'Python')
-rw-r--r--Python/pythonrun.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/Python/pythonrun.c b/Python/pythonrun.c
index 37feeca..e8f4fa2 100644
--- a/Python/pythonrun.c
+++ b/Python/pythonrun.c
@@ -531,11 +531,15 @@ Py_NewInterpreter(void)
bimod = _PyImport_FindExtension("__builtin__", "__builtin__");
if (bimod != NULL) {
interp->builtins = PyModule_GetDict(bimod);
+ if (interp->builtins == NULL)
+ goto handle_error;
Py_INCREF(interp->builtins);
}
sysmod = _PyImport_FindExtension("sys", "sys");
if (bimod != NULL && sysmod != NULL) {
interp->sysdict = PyModule_GetDict(sysmod);
+ if (interp->sysdict == NULL)
+ goto handle_error;
Py_INCREF(interp->sysdict);
PySys_SetPath(Py_GetPath());
PyDict_SetItemString(interp->sysdict, "modules",
@@ -549,6 +553,7 @@ Py_NewInterpreter(void)
if (!PyErr_Occurred())
return tstate;
+handle_error:
/* Oops, it didn't work. Undo it all. */
PyErr_Print();