commit | 4c6e8088f52c4a1d33ff529685512fd6ebe0d21a | [log] [tgz] |
---|---|---|
author | Benjamin Peterson <benjamin@python.org> | Sat Aug 15 13:16:38 2009 +0000 |
committer | Benjamin Peterson <benjamin@python.org> | Sat Aug 15 13:16:38 2009 +0000 |
tree | 26fd508689ec6c19187d4ef63534a8990acd3902 | |
parent | 75e1f9985aee7b52812140776120e82c103e7e9a [diff] [blame] |
#6707 fix a crash with dir() on an uninitialized module
diff --git a/Objects/object.c b/Objects/object.c index 0191ebe..3c7facb 100644 --- a/Objects/object.c +++ b/Objects/object.c
@@ -1810,9 +1810,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); } }