Change readbuffer_encode() and charbuffer_encode() to
return bytes objects.
diff --git a/Modules/_codecsmodule.c b/Modules/_codecsmodule.c
index de5270d..1199671 100644
--- a/Modules/_codecsmodule.c
+++ b/Modules/_codecsmodule.c
@@ -533,8 +533,7 @@
&data, &size, &errors))
return NULL;
- return codec_tuple(PyString_FromStringAndSize(data, size),
- size);
+ return codec_tuple(PyBytes_FromStringAndSize(data, size), size);
}
static PyObject *
@@ -549,8 +548,7 @@
&data, &size, &errors))
return NULL;
- return codec_tuple(PyString_FromStringAndSize(data, size),
- size);
+ return codec_tuple(PyBytes_FromStringAndSize(data, size), size);
}
static PyObject *
@@ -569,14 +567,12 @@
if (PyUnicode_Check(obj)) {
data = PyUnicode_AS_DATA(obj);
size = PyUnicode_GET_DATA_SIZE(obj);
- return codec_tuple(PyString_FromStringAndSize(data, size),
- size);
+ return codec_tuple(PyBytes_FromStringAndSize(data, size), size);
}
else {
if (PyObject_AsReadBuffer(obj, (const void **)&data, &size))
return NULL;
- return codec_tuple(PyString_FromStringAndSize(data, size),
- size);
+ return codec_tuple(PyBytes_FromStringAndSize(data, size), size);
}
}