summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWalter Dörwald <walter@livinglogic.de>2007-06-11 15:47:13 (GMT)
committerWalter Dörwald <walter@livinglogic.de>2007-06-11 15:47:13 (GMT)
commit75163600de0a6f4a4fe7cfc851cc6d3c517cb475 (patch)
treecf0c86eca255ad25052699d740610177ba6fc835
parentd376dd9700b6ffe31feba2447543b3c55d2f10cd (diff)
downloadcpython-75163600de0a6f4a4fe7cfc851cc6d3c517cb475.zip
cpython-75163600de0a6f4a4fe7cfc851cc6d3c517cb475.tar.gz
cpython-75163600de0a6f4a4fe7cfc851cc6d3c517cb475.tar.bz2
Simplify error formatting and type_repr().
-rw-r--r--Objects/typeobject.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/Objects/typeobject.c b/Objects/typeobject.c
index b826eb4..d8da4fc 100644
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -384,12 +384,8 @@ type_repr(PyTypeObject *type)
else
kind = "type";
- if (mod != NULL && strcmp(PyUnicode_AsString(mod), "__builtin__")) {
- rtn = PyUnicode_FromFormat("<%s '%s.%s'>",
- kind,
- PyUnicode_AsString(mod),
- PyUnicode_AsString(name));
- }
+ if (mod != NULL && PyUnicode_CompareWithASCIIString(mod, "__builtin__"))
+ rtn = PyUnicode_FromFormat("<%s '%U.%U'>", kind, mod, name);
else
rtn = PyUnicode_FromFormat("<%s '%s'>", kind, type->tp_name);
@@ -2155,8 +2151,8 @@ type_getattro(PyTypeObject *type, PyObject *name)
/* Give up */
PyErr_Format(PyExc_AttributeError,
- "type object '%.50s' has no attribute '%.400s'",
- type->tp_name, PyUnicode_AsString(name));
+ "type object '%.50s' has no attribute '%U'",
+ type->tp_name, name);
return NULL;
}