[Python-checkins] r55114 - python/branches/py3k-struni/Objects/object.c

guido.van.rossum python-checkins at python.org
Fri May 4 07:14:31 CEST 2007


Author: guido.van.rossum
Date: Fri May  4 07:14:29 2007
New Revision: 55114

Modified:
   python/branches/py3k-struni/Objects/object.c
Log:
It's ok for __repr__ to return unicode.


Modified: python/branches/py3k-struni/Objects/object.c
==============================================================================
--- python/branches/py3k-struni/Objects/object.c	(original)
+++ python/branches/py3k-struni/Objects/object.c	Fri May  4 07:14:29 2007
@@ -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)",


More information about the Python-checkins mailing list