From 35d9428046e74cd9c36fb4507ca048dad32097cc Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Mon, 27 Aug 2007 18:20:11 +0000 Subject: 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!) --- Objects/unicodeobject.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index c799417..5593ada 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -6407,19 +6407,13 @@ unicode_encode(PyUnicodeObject *self, PyObject *args) 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)", -- cgit v0.12