Browse Source

Fixed possible reference leak to mod when type_name() returns NULL

pull/2332/head
Christian Heimes 14 years ago
parent
commit
a0e7e41cba
  1. 4
      Objects/typeobject.c

4
Objects/typeobject.c

@ -647,8 +647,10 @@ type_repr(PyTypeObject *type)
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("<class '%U.%U'>", mod, name);

Loading…
Cancel
Save