diff options
| author | Neal Norwitz <nnorwitz@gmail.com> | 2006-08-21 20:16:24 +0000 |
|---|---|---|
| committer | Neal Norwitz <nnorwitz@gmail.com> | 2006-08-21 20:16:24 +0000 |
| commit | be0e30a27fc93ac72bdb5e7e0df61464c04d280e (patch) | |
| tree | 970a601b80901ba5c1674bcebc35d5095a4a3e9d /Python/pythonrun.c | |
| parent | 02bbbc408ee08cb5751882265651c661184e9ec0 (diff) | |
| download | cpython-be0e30a27fc93ac72bdb5e7e0df61464c04d280e.tar.gz | |
Handle a few more error conditions.
Klocwork 301 and 302. Will backport.
Diffstat (limited to 'Python/pythonrun.c')
| -rw-r--r-- | Python/pythonrun.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Python/pythonrun.c b/Python/pythonrun.c index 37feeca3f3..e8f4fa2e56 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(); |
