diff options
author | Guido van Rossum <guido@python.org> | 2007-05-04 05:14:29 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2007-05-04 05:14:29 (GMT) |
commit | c8c82333c69c09d596bcfbd55a02fbfcb8dd4ed3 (patch) | |
tree | 93fb40755e8c2dcd691ecbc1e769645cee8b8387 /Objects/object.c | |
parent | d7c43dd5a20ce9b4d4aa4e6490fb7fea7c2609f8 (diff) | |
download | cpython-c8c82333c69c09d596bcfbd55a02fbfcb8dd4ed3.zip cpython-c8c82333c69c09d596bcfbd55a02fbfcb8dd4ed3.tar.gz cpython-c8c82333c69c09d596bcfbd55a02fbfcb8dd4ed3.tar.bz2 |
It's ok for __repr__ to return unicode.
Diffstat (limited to 'Objects/object.c')
-rw-r--r-- | Objects/object.c | 11 |
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)", |