mirror of
https://github.com/python/cpython.git
synced 2025-11-03 19:34:08 +00:00
__module__ is a unicode string now:
use PyUnicode_CompareWithASCIIString() instead of strcmp(). Simplify repr formatting.
This commit is contained in:
parent
641d5cc6a6
commit
4dbd01b435
1 changed files with 2 additions and 5 deletions
|
|
@ -2479,11 +2479,8 @@ object_repr(PyObject *self)
|
||||||
name = type_name(type, NULL);
|
name = type_name(type, NULL);
|
||||||
if (name == NULL)
|
if (name == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
if (mod != NULL && strcmp(PyString_AS_STRING(mod), "__builtin__"))
|
if (mod != NULL && PyUnicode_CompareWithASCIIString(mod, "__builtin__"))
|
||||||
rtn = PyUnicode_FromFormat("<%s.%s object at %p>",
|
rtn = PyUnicode_FromFormat("<%U.%U object at %p>", mod, name, self);
|
||||||
PyUnicode_AsString(mod),
|
|
||||||
PyUnicode_AsString(name),
|
|
||||||
self);
|
|
||||||
else
|
else
|
||||||
rtn = PyUnicode_FromFormat("<%s object at %p>",
|
rtn = PyUnicode_FromFormat("<%s object at %p>",
|
||||||
type->tp_name, self);
|
type->tp_name, self);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue