diff Objects/object.c @ 41601:b39abcbbbbba

It's ok for __repr__ to return unicode.
author Guido van Rossum <guido@python.org>
date Fri, 04 May 2007 05:14:29 +0000
parents 2c54763c4504
children ddc4be2786fd
line wrap: on
line diff
--- a/Objects/object.c	Fri May 04 05:06:43 2007 +0000
+++ b/Objects/object.c	Fri May 04 05:14:29 2007 +0000
@@ -361,15 +361,8 @@
 		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)",