summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2007-08-27 18:20:11 (GMT)
committerGuido van Rossum <guido@python.org>2007-08-27 18:20:11 (GMT)
commit35d9428046e74cd9c36fb4507ca048dad32097cc (patch)
tree60842622c5c93594a374ad1c2c98d732bd00a181
parent700bd926778b06bfd955ace944b863c722b40872 (diff)
downloadcpython-35d9428046e74cd9c36fb4507ca048dad32097cc.zip
cpython-35d9428046e74cd9c36fb4507ca048dad32097cc.tar.gz
cpython-35d9428046e74cd9c36fb4507ca048dad32097cc.tar.bz2
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!)
-rw-r--r--Objects/unicodeobject.c8
1 files changed, 1 insertions, 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)",