From c8c82333c69c09d596bcfbd55a02fbfcb8dd4ed3 Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Fri, 4 May 2007 05:14:29 +0000 Subject: It's ok for __repr__ to return unicode. --- Objects/object.c | 11 ++--------- 1 file 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)", -- cgit v0.12