summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
Diffstat (limited to 'Objects')
-rw-r--r--Objects/object.c8
1 files changed, 5 insertions, 3 deletions
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 @@ _specialized_dir_module(PyObject *obj)
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);
}
}