diff Objects/object.c @ 55645:bc1c403054e1 2.6

Merged revisions 74457 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r74457 | benjamin.peterson | 2009-08-15 08:16:38 -0500 (Sat, 15 Aug 2009) | 1 line #6707 fix a crash with dir() on an uninitialized module ........
author Benjamin Peterson <benjamin@python.org>
date Sat, 15 Aug 2009 13:18:47 +0000
parents 74c0a78114ae
children e38335d4df91
line wrap: on
line diff
--- a/Objects/object.c	Sat Aug 15 06:40:49 2009 +0000
+++ b/Objects/object.c	Sat Aug 15 13:18:47 2009 +0000
@@ -1806,9 +1806,11 @@
 		if (PyDict_Check(dict))
 			result = PyDict_Keys(dict);
 		else {
-			PyErr_Format(PyExc_TypeError,
-				     "%.200s.__dict__ is not a dictionary",
-				     PyModule_GetName(obj));
+			char *name = PyModule_GetName(obj);
+			if (name)
+				PyErr_Format(PyExc_TypeError,
+					     "%.200s.__dict__ is not a dictionary",
+					     name);
 		}
 	}