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

guido.van.rossum python-3000-checkins at python.org
Mon Aug 27 20:20:12 CEST 2007


Author: guido.van.rossum
Date: Mon Aug 27 20:20:11 2007
New Revision: 57566

Modified:
   python/branches/py3k/Objects/unicodeobject.c
Log:
There should be no codecs left that return str8 intead of bytes.
(And if there are, they will now get an error when used.  So fix them!)


Modified: python/branches/py3k/Objects/unicodeobject.c
==============================================================================
--- python/branches/py3k/Objects/unicodeobject.c	(original)
+++ python/branches/py3k/Objects/unicodeobject.c	Mon Aug 27 20:20:11 2007
@@ -6407,19 +6407,13 @@
     char *encoding = NULL;
     char *errors = NULL;
     PyObject *v;
-    
+
     if (!PyArg_ParseTuple(args, "|ss:encode", &encoding, &errors))
         return NULL;
     v = PyUnicode_AsEncodedObject((PyObject *)self, encoding, errors);
     if (v == NULL)
         goto onError;
     if (!PyBytes_Check(v)) {
-        if (PyString_Check(v)) {
-            /* Old codec, turn it into bytes */
-            PyObject *b = PyBytes_FromObject(v);
-            Py_DECREF(v);
-            return b;
-        }
         PyErr_Format(PyExc_TypeError,
                      "encoder did not return a bytes object "
                      "(type=%.400s)",


More information about the Python-3000-checkins mailing list