mirror of
https://github.com/python/cpython.git
synced 2025-11-25 21:11:09 +00:00
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.
This commit is contained in:
parent
4efb518185
commit
b2750b5d33
8 changed files with 171 additions and 41 deletions
|
|
@ -27,7 +27,7 @@ PyAPI_FUNC(int) PyCodec_Register(
|
|||
PyObject *search_function
|
||||
);
|
||||
|
||||
/* Codec register lookup API.
|
||||
/* Codec registry lookup API.
|
||||
|
||||
Looks up the given encoding and returns a CodecInfo object with
|
||||
function attributes which implement the different aspects of
|
||||
|
|
@ -49,6 +49,17 @@ PyAPI_FUNC(PyObject *) _PyCodec_Lookup(
|
|||
const char *encoding
|
||||
);
|
||||
|
||||
/* Codec registry encoding check API.
|
||||
|
||||
Returns 1/0 depending on whether there is a registered codec for
|
||||
the given encoding.
|
||||
|
||||
*/
|
||||
|
||||
PyAPI_FUNC(int) PyCodec_KnownEncoding(
|
||||
const char *encoding
|
||||
);
|
||||
|
||||
/* Generic codec based encoding API.
|
||||
|
||||
object is passed through the encoder function found for the given
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue