summaryrefslogtreecommitdiffstats
path: root/Python/pythonrun.c
diff options
context:
space:
mode:
authorAndrew M. Kuchling <amk@amk.ca>2006-10-03 19:11:32 (GMT)
committerAndrew M. Kuchling <amk@amk.ca>2006-10-03 19:11:32 (GMT)
commit58e5c1149a94bed13a0b7a1b5b2b817f0f365f81 (patch)
tree224433af606625e5bec4a3014cc8cb1f10cd81f5 /Python/pythonrun.c
parentfec767442089180f5642c4f57261b6f3a05dcc35 (diff)
downloadcpython-58e5c1149a94bed13a0b7a1b5b2b817f0f365f81.zip
cpython-58e5c1149a94bed13a0b7a1b5b2b817f0f365f81.tar.gz
cpython-58e5c1149a94bed13a0b7a1b5b2b817f0f365f81.tar.bz2
[Backport r51443 | neal.norwitz]
Handle a few more error conditions. Klocwork 301 and 302. Will backport.
Diffstat (limited to 'Python/pythonrun.c')
-rw-r--r--Python/pythonrun.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/Python/pythonrun.c b/Python/pythonrun.c
index 9ef1fea..6d6d1d5 100644
--- a/Python/pythonrun.c
+++ b/Python/pythonrun.c
@@ -497,11 +497,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",
@@ -515,6 +519,7 @@ Py_NewInterpreter(void)
if (!PyErr_Occurred())
return tstate;
+handle_error:
/* Oops, it didn't work. Undo it all. */
PyErr_Print();