diff options
author | Walter Dörwald <walter@livinglogic.de> | 2007-06-11 15:47:13 +0000 |
---|---|---|
committer | Walter Dörwald <walter@livinglogic.de> | 2007-06-11 15:47:13 +0000 |
commit | 733343ea9f9b1e118f9205fcf9c0c4661b4ee5f3 (patch) | |
tree | 8d11719b8af5ddb42393d1ed427f569ac396c873 | |
parent | 585ba0d1837239daad7e8fab32386c44f236e6d7 (diff) | |
download | cpython-733343ea9f9b1e118f9205fcf9c0c4661b4ee5f3.tar.gz |
Simplify error formatting and type_repr().
-rw-r--r-- | Objects/typeobject.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/Objects/typeobject.c b/Objects/typeobject.c index b826eb4be0..d8da4fcdc6 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; } |