diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2021-10-14 10:17:00 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-14 10:17:00 (GMT) |
commit | c96d1546b11b4c282a7e21737cb1f5d16349656d (patch) | |
tree | 5e6e49378a4207591316f08e6b7fd42d4e3ff40c /Include/cpython/unicodeobject.h | |
parent | e71662c1ae817e728233ce93882c5b20f4c31ebc (diff) | |
download | cpython-c96d1546b11b4c282a7e21737cb1f5d16349656d.zip cpython-c96d1546b11b4c282a7e21737cb1f5d16349656d.tar.gz cpython-c96d1546b11b4c282a7e21737cb1f5d16349656d.tar.bz2 |
bpo-45461: Fix IncrementalDecoder and StreamReader in the "unicode-escape" codec (GH-28939)
They support now splitting escape sequences between input chunks.
Add the third parameter "final" in codecs.unicode_escape_decode().
It is True by default to match the former behavior.
Diffstat (limited to 'Include/cpython/unicodeobject.h')
-rw-r--r-- | Include/cpython/unicodeobject.h | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/Include/cpython/unicodeobject.h b/Include/cpython/unicodeobject.h index 0cbdbdb..bc5a3b4 100644 --- a/Include/cpython/unicodeobject.h +++ b/Include/cpython/unicodeobject.h @@ -777,12 +777,20 @@ PyAPI_FUNC(PyObject*) _PyUnicode_EncodeUTF16( /* --- Unicode-Escape Codecs ---------------------------------------------- */ +/* Variant of PyUnicode_DecodeUnicodeEscape that supports partial decoding. */ +PyAPI_FUNC(PyObject*) _PyUnicode_DecodeUnicodeEscapeStateful( + const char *string, /* Unicode-Escape encoded string */ + Py_ssize_t length, /* size of string */ + const char *errors, /* error handling */ + Py_ssize_t *consumed /* bytes consumed */ +); /* Helper for PyUnicode_DecodeUnicodeEscape that detects invalid escape chars. */ -PyAPI_FUNC(PyObject*) _PyUnicode_DecodeUnicodeEscape( +PyAPI_FUNC(PyObject*) _PyUnicode_DecodeUnicodeEscapeInternal( const char *string, /* Unicode-Escape encoded string */ Py_ssize_t length, /* size of string */ const char *errors, /* error handling */ + Py_ssize_t *consumed, /* bytes consumed */ const char **first_invalid_escape /* on return, points to first invalid escaped char in string. */ |