summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2007-05-04 05:14:29 (GMT)
committerGuido van Rossum <guido@python.org>2007-05-04 05:14:29 (GMT)
commitc8c82333c69c09d596bcfbd55a02fbfcb8dd4ed3 (patch)
tree93fb40755e8c2dcd691ecbc1e769645cee8b8387 /Objects
parentd7c43dd5a20ce9b4d4aa4e6490fb7fea7c2609f8 (diff)
downloadcpython-c8c82333c69c09d596bcfbd55a02fbfcb8dd4ed3.zip
cpython-c8c82333c69c09d596bcfbd55a02fbfcb8dd4ed3.tar.gz
cpython-c8c82333c69c09d596bcfbd55a02fbfcb8dd4ed3.tar.bz2
It's ok for __repr__ to return unicode.
Diffstat (limited to 'Objects')
-rw-r--r--Objects/object.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/Objects/object.c b/Objects/object.c
index 81f5669..8597d88 100644
--- a/Objects/object.c
+++ b/Objects/object.c
@@ -361,15 +361,8 @@ PyObject_Repr(PyObject *v)
res = (*v->ob_type->tp_repr)(v);
if (res == NULL)
return NULL;
- if (PyUnicode_Check(res)) {
- PyObject* str;
- str = PyUnicode_AsEncodedString(res, NULL, NULL);
- Py_DECREF(res);
- if (str)
- res = str;
- else
- return NULL;
- }
+ if (PyUnicode_Check(res))
+ return res;
if (!PyString_Check(res)) {
PyErr_Format(PyExc_TypeError,
"__repr__ returned non-string (type %.200s)",