diff options
author | Gregory P. Smith <greg@mad-scientist.com> | 2008-06-09 04:58:54 +0000 |
---|---|---|
committer | Gregory P. Smith <greg@mad-scientist.com> | 2008-06-09 04:58:54 +0000 |
commit | dd96db63f689e2f0d8ae5a1436b3b3395eec7de5 (patch) | |
tree | b2299acac9ce44fc488fc7b2ae2a44548cd5fbb8 /Modules/_codecsmodule.c | |
parent | e98839a1f48b2915f1cc747884e64f4d6e4c8e7a (diff) | |
download | cpython-git-dd96db63f689e2f0d8ae5a1436b3b3395eec7de5.tar.gz |
This reverts r63675 based on the discussion in this thread:
http://mail.python.org/pipermail/python-dev/2008-June/079988.html
Python 2.6 should stick with PyString_* in its codebase. The PyBytes_* names
in the spirit of 3.0 are available via a #define only. See the email thread.
Diffstat (limited to 'Modules/_codecsmodule.c')
-rw-r--r-- | Modules/_codecsmodule.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/Modules/_codecsmodule.c b/Modules/_codecsmodule.c index e374766727..d4eb0d5b9c 100644 --- a/Modules/_codecsmodule.c +++ b/Modules/_codecsmodule.c @@ -168,7 +168,7 @@ escape_decode(PyObject *self, if (!PyArg_ParseTuple(args, "s#|z:escape_decode", &data, &size, &errors)) return NULL; - return codec_tuple(PyBytes_DecodeEscape(data, size, errors, 0, NULL), + return codec_tuple(PyString_DecodeEscape(data, size, errors, 0, NULL), size); } @@ -182,21 +182,21 @@ escape_encode(PyObject *self, Py_ssize_t len; if (!PyArg_ParseTuple(args, "O!|z:escape_encode", - &PyBytes_Type, &str, &errors)) + &PyString_Type, &str, &errors)) return NULL; - str = PyBytes_Repr(str, 0); + str = PyString_Repr(str, 0); if (!str) return NULL; /* The string will be quoted. Unquote, similar to unicode-escape. */ - buf = PyBytes_AS_STRING (str); - len = PyBytes_GET_SIZE (str); + buf = PyString_AS_STRING (str); + len = PyString_GET_SIZE (str); memmove(buf, buf+1, len-2); - if (_PyBytes_Resize(&str, len-2) < 0) + if (_PyString_Resize(&str, len-2) < 0) return NULL; - return codec_tuple(str, PyBytes_Size(str)); + return codec_tuple(str, PyString_Size(str)); } #ifdef Py_USING_UNICODE @@ -640,7 +640,7 @@ readbuffer_encode(PyObject *self, &data, &size, &errors)) return NULL; - return codec_tuple(PyBytes_FromStringAndSize(data, size), + return codec_tuple(PyString_FromStringAndSize(data, size), size); } @@ -656,7 +656,7 @@ charbuffer_encode(PyObject *self, &data, &size, &errors)) return NULL; - return codec_tuple(PyBytes_FromStringAndSize(data, size), + return codec_tuple(PyString_FromStringAndSize(data, size), size); } @@ -676,13 +676,13 @@ unicode_internal_encode(PyObject *self, if (PyUnicode_Check(obj)) { data = PyUnicode_AS_DATA(obj); size = PyUnicode_GET_DATA_SIZE(obj); - return codec_tuple(PyBytes_FromStringAndSize(data, size), + return codec_tuple(PyString_FromStringAndSize(data, size), size); } else { if (PyObject_AsReadBuffer(obj, (const void **)&data, &size)) return NULL; - return codec_tuple(PyBytes_FromStringAndSize(data, size), + return codec_tuple(PyString_FromStringAndSize(data, size), size); } } |