diff options
author | Marc-André Lemburg <mal@egenix.com> | 2008-06-06 12:18:17 (GMT) |
---|---|---|
committer | Marc-André Lemburg <mal@egenix.com> | 2008-06-06 12:18:17 (GMT) |
commit | b2750b5d334e9c8d262009069bce41c15803eca0 (patch) | |
tree | 2c501adf96b37d3afbc32e6fdc344fade85cf3d5 /Objects/bytearrayobject.c | |
parent | 4efb518185d32d573ff65f11b94c6031340a018a (diff) | |
download | cpython-b2750b5d334e9c8d262009069bce41c15803eca0.zip cpython-b2750b5d334e9c8d262009069bce41c15803eca0.tar.gz cpython-b2750b5d334e9c8d262009069bce41c15803eca0.tar.bz2 |
Move the codec decode type checks to bytes/bytearray.decode().
Use faster PyUnicode_FromEncodedObject() for bytes/bytearray.decode().
Add new PyCodec_KnownEncoding() API.
Add new PyUnicode_AsDecodedUnicode() and PyUnicode_AsEncodedUnicode() APIs.
Add missing PyUnicode_AsDecodedObject() to unicodeobject.h
Fix punicode codec to also work on memoryviews.
Diffstat (limited to 'Objects/bytearrayobject.c')
-rw-r--r-- | Objects/bytearrayobject.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Objects/bytearrayobject.c b/Objects/bytearrayobject.c index 75a8eef..70921c0 100644 --- a/Objects/bytearrayobject.c +++ b/Objects/bytearrayobject.c @@ -725,7 +725,7 @@ bytes_init(PyByteArrayObject *self, PyObject *args, PyObject *kwds) "string argument without an encoding"); return -1; } - encoded = PyCodec_Encode(arg, encoding, errors); + encoded = PyUnicode_AsEncodedString(arg, encoding, errors); if (encoded == NULL) return -1; assert(PyBytes_Check(encoded)); @@ -2854,7 +2854,7 @@ bytes_decode(PyObject *self, PyObject *args) return NULL; if (encoding == NULL) encoding = PyUnicode_GetDefaultEncoding(); - return PyCodec_Decode(self, encoding, errors); + return PyUnicode_FromEncodedObject(self, encoding, errors); } PyDoc_STRVAR(alloc_doc, |