mirror of
https://github.com/python/cpython.git
synced 2025-11-25 04:34:37 +00:00
Close #20404: blacklist non-text encodings in io.TextIOWrapper
- io.TextIOWrapper (and hence the open() builtin) now use the internal codec marking system added for issue #19619 - also tweaked the C code to only look up the encoding once, rather than multiple times - the existing output type checks remain in place to deal with unmarked third party codecs.
This commit is contained in:
parent
1ea4e4174b
commit
a9b15241c6
6 changed files with 141 additions and 41 deletions
|
|
@ -104,7 +104,14 @@ PyAPI_FUNC(PyObject *) PyCodec_Decode(
|
|||
Please note that these APIs are internal and should not
|
||||
be used in Python C extensions.
|
||||
|
||||
XXX (ncoghlan): should we make these, or something like them, public
|
||||
in Python 3.5+?
|
||||
|
||||
*/
|
||||
PyAPI_FUNC(PyObject *) _PyCodec_LookupTextEncoding(
|
||||
const char *encoding,
|
||||
const char *alternate_command
|
||||
);
|
||||
|
||||
PyAPI_FUNC(PyObject *) _PyCodec_EncodeText(
|
||||
PyObject *object,
|
||||
|
|
@ -117,6 +124,19 @@ PyAPI_FUNC(PyObject *) _PyCodec_DecodeText(
|
|||
const char *encoding,
|
||||
const char *errors
|
||||
);
|
||||
|
||||
/* These two aren't actually text encoding specific, but _io.TextIOWrapper
|
||||
* is the only current API consumer.
|
||||
*/
|
||||
PyAPI_FUNC(PyObject *) _PyCodecInfo_GetIncrementalDecoder(
|
||||
PyObject *codec_info,
|
||||
const char *errors
|
||||
);
|
||||
|
||||
PyAPI_FUNC(PyObject *) _PyCodecInfo_GetIncrementalEncoder(
|
||||
PyObject *codec_info,
|
||||
const char *errors
|
||||
);
|
||||
#endif
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue