Mercurial > cpython-lru_cache-weakref
diff Python/pythonrun.c @ 39971:8c83fd79cee5 2.4
[Backport r51443 | neal.norwitz]
Handle a few more error conditions.
Klocwork 301 and 302. Will backport.
| author | Andrew M. Kuchling <amk@amk.ca> |
|---|---|
| date | Tue, 03 Oct 2006 19:11:32 +0000 |
| parents | 54d177ede883 |
| children | e65836815791 |
line wrap: on
line diff
--- a/Python/pythonrun.c Tue Oct 03 19:08:48 2006 +0000 +++ b/Python/pythonrun.c Tue Oct 03 19:11:32 2006 +0000 @@ -497,11 +497,15 @@ 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 @@ if (!PyErr_Occurred()) return tstate; +handle_error: /* Oops, it didn't work. Undo it all. */ PyErr_Print();
