summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Objects/typeobject.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/Objects/typeobject.c b/Objects/typeobject.c
index 69cb02da09..e527eed792 100644
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -686,8 +686,10 @@ type_repr(PyTypeObject *type)
mod = NULL;
}
name = type_name(type, NULL);
- if (name == NULL)
+ if (name == NULL) {
+ Py_XDECREF(mod);
return NULL;
+ }
if (type->tp_flags & Py_TPFLAGS_HEAPTYPE)
kind = "class";