Fixed possible reference leak to mod when type_name() returns NULL
This commit is contained in:
commit
455657961e
|
@ -691,8 +691,10 @@ type_repr(PyTypeObject *type)
|
|||
mod = NULL;
|
||||
}
|
||||
name = type_qualname(type, NULL);
|
||||
if (name == NULL)
|
||||
if (name == NULL) {
|
||||
Py_XDECREF(mod);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (mod != NULL && PyUnicode_CompareWithASCIIString(mod, "builtins"))
|
||||
rtn = PyUnicode_FromFormat("<class '%U.%U'>", mod, name);
|
||||
|
|
Loading…
Reference in New Issue