diff Objects/typeobject.c @ 46336:56e49952d1a4

Bug #2565: The repr() of type objects now calls them 'class', not 'type' - whether they are builtin types or not.
author Martin v. Löwis <martin@v.loewis.de>
date Mon, 07 Apr 2008 05:43:42 +0000
parents 8dd30fe11a4b
children ea594306ea85
line wrap: on
line diff
--- a/Objects/typeobject.c	Mon Apr 07 03:22:07 2008 +0000
+++ b/Objects/typeobject.c	Mon Apr 07 05:43:42 2008 +0000
@@ -600,7 +600,6 @@
 type_repr(PyTypeObject *type)
 {
 	PyObject *mod, *name, *rtn;
-	char *kind;
 
 	mod = type_module(type, NULL);
 	if (mod == NULL)
@@ -613,15 +612,10 @@
 	if (name == NULL)
 		return NULL;
 
-	if (type->tp_flags & Py_TPFLAGS_HEAPTYPE)
-		kind = "class";
+	if (mod != NULL && PyUnicode_CompareWithASCIIString(mod, "builtins"))
+		rtn = PyUnicode_FromFormat("<class '%U.%U'>", mod, name);
 	else
-		kind = "type";
-
-	if (mod != NULL && PyUnicode_CompareWithASCIIString(mod, "builtins"))
-		rtn = PyUnicode_FromFormat("<%s '%U.%U'>", kind, 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);