]> granicus.if.org Git - python/commitdiff
__module__ is a unicode string now:
authorWalter Dörwald <walter@livinglogic.de>
Mon, 11 Jun 2007 14:03:45 +0000 (14:03 +0000)
committerWalter Dörwald <walter@livinglogic.de>
Mon, 11 Jun 2007 14:03:45 +0000 (14:03 +0000)
use PyUnicode_CompareWithASCIIString() instead of
strcmp().

Simplify repr formatting.

Objects/typeobject.c

index 4fc51a626ab9fc5bd98a9b0207ea1568deb00790..bc5fad1c1370b9f5f41bdca57e778ba450aa0485 100644 (file)
@@ -2479,11 +2479,8 @@ object_repr(PyObject *self)
        name = type_name(type, NULL);
        if (name == NULL)
                return NULL;
-       if (mod != NULL && strcmp(PyString_AS_STRING(mod), "__builtin__"))
-               rtn = PyUnicode_FromFormat("<%s.%s object at %p>",
-                                         PyUnicode_AsString(mod),
-                                         PyUnicode_AsString(name),
-                                         self);
+       if (mod != NULL && PyUnicode_CompareWithASCIIString(mod, "__builtin__"))
+               rtn = PyUnicode_FromFormat("<%U.%U object at %p>", mod, name, self);
        else
                rtn = PyUnicode_FromFormat("<%s object at %p>",
                                          type->tp_name, self);