summaryrefslogtreecommitdiffstats
path: root/Python/errors.c
diff options
context:
space:
mode:
Diffstat (limited to 'Python/errors.c')
-rw-r--r--Python/errors.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/Python/errors.c b/Python/errors.c
index f7a1c08..a40f073 100644
--- a/Python/errors.c
+++ b/Python/errors.c
@@ -588,13 +588,16 @@ PyErr_WriteUnraisable(PyObject *obj)
if (f != NULL) {
PyFile_WriteString("Exception ", f);
if (t) {
- char* className = PyExceptionClass_Name(t);
PyObject* moduleName;
- char *dot = strrchr(className, '.');
- if (dot != NULL)
- className = dot+1;
- moduleName = PyObject_GetAttrString(t, "__module__");
+ char* className = PyExceptionClass_Name(t);
+ if (className != NULL) {
+ char *dot = strrchr(className, '.');
+ if (dot != NULL)
+ className = dot+1;
+ }
+
+ moduleName = PyObject_GetAttrString(t, "__module__");
if (moduleName == NULL)
PyFile_WriteString("<unknown>", f);
else {