[Python-3000-checkins] r58771 - python/branches/py3k-pep3137/Objects/unicodeobject.c

guido.van.rossum python-3000-checkins at python.org
Fri Nov 2 15:25:47 CET 2007


Author: guido.van.rossum
Date: Fri Nov  2 15:25:46 2007
New Revision: 58771

Modified:
   python/branches/py3k-pep3137/Objects/unicodeobject.c
Log:
Remove implicit str() call in "".join() argument.


Modified: python/branches/py3k-pep3137/Objects/unicodeobject.c
==============================================================================
--- python/branches/py3k-pep3137/Objects/unicodeobject.c	(original)
+++ python/branches/py3k-pep3137/Objects/unicodeobject.c	Fri Nov  2 15:25:46 2007
@@ -5470,20 +5470,14 @@
 
 	item = PySequence_Fast_GET_ITEM(fseq, i);
 	/* Convert item to Unicode. */
-	if (!PyString_Check(item) && !PyUnicode_Check(item))
-	{
-		if (PyBytes_Check(item))
-		{
-			PyErr_Format(PyExc_TypeError,
-                            "sequence item %d: join() will not operate on "
-                            "bytes objects", i);
-			goto onError;
-		}
-		item = PyObject_Unicode(item);
+	if (!PyUnicode_Check(item)) {
+	    PyErr_Format(PyExc_TypeError,
+			 "sequence item %zd: expected str instance,"
+			 " %.80s found",
+			 i, Py_Type(item)->tp_name);
+	    goto onError;
 	}
-	else
-		item = PyUnicode_FromObject(item);
-
+	item = PyUnicode_FromObject(item);
 	if (item == NULL)
 	    goto onError;
 	/* We own a reference to item from here on. */


More information about the Python-3000-checkins mailing list