From b2750b5d334e9c8d262009069bce41c15803eca0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lemburg?= Date: Fri, 6 Jun 2008 12:18:17 +0000 Subject: 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. --- Objects/bytesobject.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Objects/bytesobject.c') diff --git a/Objects/bytesobject.c b/Objects/bytesobject.c index ab6207be94..471d09c7ec 100644 --- a/Objects/bytesobject.c +++ b/Objects/bytesobject.c @@ -2713,7 +2713,7 @@ string_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); } @@ -2899,7 +2899,7 @@ string_new(PyTypeObject *type, PyObject *args, PyObject *kwds) "string argument without an encoding"); return NULL; } - new = PyCodec_Encode(x, encoding, errors); + new = PyUnicode_AsEncodedString(x, encoding, errors); if (new == NULL) return NULL; assert(PyBytes_Check(new)); -- cgit v1.2.1