Mercurial > cpython-lru_cache-weakref
diff Modules/_codecsmodule.c @ 42124:4590129e4c2b
Change readbuffer_encode() and charbuffer_encode() to
return bytes objects.
| author | Walter Dörwald <walter@livinglogic.de> |
|---|---|
| date | Fri, 22 Jun 2007 12:17:08 +0000 |
| parents | cd125fe83051 |
| children | 4bbbe0c55fa2 |
line wrap: on
line diff
--- a/Modules/_codecsmodule.c Wed Jun 20 15:11:12 2007 +0000 +++ b/Modules/_codecsmodule.c Fri Jun 22 12:17:08 2007 +0000 @@ -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); } }
