From: Guido van Rossum Date: Fri, 4 May 2007 05:14:29 +0000 (+0000) Subject: It's ok for __repr__ to return unicode. X-Git-Tag: v3.0a1~1021 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c8c82333c69c09d596bcfbd55a02fbfcb8dd4ed3;p=thirdparty%2FPython%2Fcpython.git It's ok for __repr__ to return unicode. --- diff --git a/Objects/object.c b/Objects/object.c index 81f566945353..8597d888fb75 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)",