Mercurial > cpython-lru_cache-weakref
diff Python/pythonrun.c @ 39614:9dee81dcb9b4 legacy-trunk
Handle a few more error conditions.
Klocwork 301 and 302. Will backport.
| author | Neal Norwitz <nnorwitz@gmail.com> |
|---|---|
| date | Mon, 21 Aug 2006 20:16:24 +0000 |
| parents | deb748f33c1d |
| children | da30a26dfeb3 b8fbd322760a |
line wrap: on
line diff
--- a/Python/pythonrun.c Mon Aug 21 19:47:08 2006 +0000 +++ b/Python/pythonrun.c Mon Aug 21 20:16:24 2006 +0000 @@ -531,11 +531,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", @@ -549,6 +553,7 @@ if (!PyErr_Occurred()) return tstate; +handle_error: /* Oops, it didn't work. Undo it all. */ PyErr_Print();
