[Python-checkins] r53256 - in python/branches/release25-maint: Misc/NEWS Python/errors.c

neal.norwitz python-checkins at python.org
Fri Jan 5 06:29:25 CET 2007


Author: neal.norwitz
Date: Fri Jan  5 06:28:50 2007
New Revision: 53256

Modified:
   python/branches/release25-maint/Misc/NEWS
   python/branches/release25-maint/Python/errors.c
Log:
Backport:
Prevent crash on shutdown which can occur if we are finalizing
and the module dict has been cleared already and some object
raises a warning (like in a __del__).


Modified: python/branches/release25-maint/Misc/NEWS
==============================================================================
--- python/branches/release25-maint/Misc/NEWS	(original)
+++ python/branches/release25-maint/Misc/NEWS	Fri Jan  5 06:28:50 2007
@@ -12,6 +12,9 @@
 Core and builtins
 -----------------
 
+- Prevent seg fault on shutdown which could occur if an object
+  raised a warning.
+
 - Bug #1566280: Explicitly invoke threading._shutdown from Py_Main,
   to avoid relying on atexit.
 

Modified: python/branches/release25-maint/Python/errors.c
==============================================================================
--- python/branches/release25-maint/Python/errors.c	(original)
+++ python/branches/release25-maint/Python/errors.c	Fri Jan  5 06:28:50 2007
@@ -640,7 +640,8 @@
 
 	if (warnings_module != NULL) {
 		dict = PyModule_GetDict(warnings_module);
-		func = PyDict_GetItemString(dict, "warn");
+		if (dict != NULL)
+			func = PyDict_GetItemString(dict, "warn");
 	}
 	if (func == NULL) {
 		PySys_WriteStderr("warning: %s\n", message);


More information about the Python-checkins mailing list