diff --git a/Objects/typeobject.c b/Objects/typeobject.c index e34b10ce40a..0fc0ad38e82 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -2925,8 +2925,10 @@ object_repr(PyObject *self) mod = NULL; } name = type_name(type, NULL); - if (name == NULL) + if (name == NULL) { + Py_XDECREF(mod); return NULL; + } if (mod != NULL && PyUnicode_CompareWithASCIIString(mod, "builtins")) rtn = PyUnicode_FromFormat("<%U.%U object at %p>", mod, name, self); else