mirror of
https://github.com/python/cpython.git
synced 2025-10-21 22:22:48 +00:00
Bug #2565: The repr() of type objects now calls them 'class',
not 'type' - whether they are builtin types or not.
This commit is contained in:
parent
5a6f4585fd
commit
250ad613f3
13 changed files with 40 additions and 43 deletions
|
@ -600,7 +600,6 @@ static PyObject *
|
|||
type_repr(PyTypeObject *type)
|
||||
{
|
||||
PyObject *mod, *name, *rtn;
|
||||
char *kind;
|
||||
|
||||
mod = type_module(type, NULL);
|
||||
if (mod == NULL)
|
||||
|
@ -613,15 +612,10 @@ type_repr(PyTypeObject *type)
|
|||
if (name == NULL)
|
||||
return NULL;
|
||||
|
||||
if (type->tp_flags & Py_TPFLAGS_HEAPTYPE)
|
||||
kind = "class";
|
||||
else
|
||||
kind = "type";
|
||||
|
||||
if (mod != NULL && PyUnicode_CompareWithASCIIString(mod, "builtins"))
|
||||
rtn = PyUnicode_FromFormat("<%s '%U.%U'>", kind, mod, name);
|
||||
rtn = PyUnicode_FromFormat("<class '%U.%U'>", mod, name);
|
||||
else
|
||||
rtn = PyUnicode_FromFormat("<%s '%s'>", kind, type->tp_name);
|
||||
rtn = PyUnicode_FromFormat("<class '%s'>", type->tp_name);
|
||||
|
||||
Py_XDECREF(mod);
|
||||
Py_DECREF(name);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue