[Python-checkins] r52113 - python/branches/release24-maint/Python/pythonrun.c

andrew.kuchling python-checkins at python.org
Tue Oct 3 21:08:48 CEST 2006


Author: andrew.kuchling
Date: Tue Oct  3 21:08:48 2006
New Revision: 52113

Modified:
   python/branches/release24-maint/Python/pythonrun.c
Log:
[Backport r51231 | neal.norwitz]

PyModule_GetDict() can fail, produce fatal errors if this happens on startup.

Klocwork #298-299.


Modified: python/branches/release24-maint/Python/pythonrun.c
==============================================================================
--- python/branches/release24-maint/Python/pythonrun.c	(original)
+++ python/branches/release24-maint/Python/pythonrun.c	Tue Oct  3 21:08:48 2006
@@ -185,12 +185,16 @@
 	if (bimod == NULL)
 		Py_FatalError("Py_Initialize: can't initialize __builtin__");
 	interp->builtins = PyModule_GetDict(bimod);
+	if (interp->builtins == NULL)
+		Py_FatalError("Py_Initialize: can't initialize builtins dict");
 	Py_INCREF(interp->builtins);
 
 	sysmod = _PySys_Init();
 	if (sysmod == NULL)
 		Py_FatalError("Py_Initialize: can't initialize sys");
 	interp->sysdict = PyModule_GetDict(sysmod);
+	if (interp->sysdict == NULL)
+		Py_FatalError("Py_Initialize: can't initialize sys dict");
 	Py_INCREF(interp->sysdict);
 	_PyImport_FixupExtension("sys", "sys");
 	PySys_SetPath(Py_GetPath());


More information about the Python-checkins mailing list