[Python-checkins] r53255 - in python/trunk: Misc/NEWS Python/errors.c

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


Author: neal.norwitz
Date: Fri Jan  5 06:25:22 2007
New Revision: 53255

Modified:
   python/trunk/Misc/NEWS
   python/trunk/Python/errors.c
Log:
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__).

Will backport.


Modified: python/trunk/Misc/NEWS
==============================================================================
--- python/trunk/Misc/NEWS	(original)
+++ python/trunk/Misc/NEWS	Fri Jan  5 06:25:22 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/trunk/Python/errors.c
==============================================================================
--- python/trunk/Python/errors.c	(original)
+++ python/trunk/Python/errors.c	Fri Jan  5 06:25:22 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