Commit c8c82333 authored by Guido van Rossum's avatar Guido van Rossum

It's ok for __repr__ to return unicode.

parent d7c43dd5
......@@ -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)",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment