mirror of
https://github.com/python/cpython.git
synced 2025-10-29 12:44:56 +00:00
[3.9] bpo-45461: Fix IncrementalDecoder and StreamReader in the "unicode-escape" codec (GH-28939) (GH-28945)
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.
(cherry picked from commit c96d1546b1)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
This commit is contained in:
parent
38fadbc5b9
commit
7c722e32bf
10 changed files with 9836 additions and 4890 deletions
|
|
@ -4640,7 +4640,7 @@ decode_unicode_with_escapes(struct compiling *c, const node *n, const char *s,
|
|||
s = buf;
|
||||
|
||||
const char *first_invalid_escape;
|
||||
v = _PyUnicode_DecodeUnicodeEscape(s, len, NULL, &first_invalid_escape);
|
||||
v = _PyUnicode_DecodeUnicodeEscapeInternal(s, len, NULL, NULL, &first_invalid_escape);
|
||||
|
||||
if (v != NULL && first_invalid_escape != NULL) {
|
||||
if (warn_invalid_escape_sequence(c, n, *first_invalid_escape) < 0) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue