[3.11] gh-99612: Fix PyUnicode_DecodeUTF8Stateful() for ASCII-only data (GH-99613) (GH-107224)

Previously *consumed was not set in this case.
(cherry picked from commit f08e52ccb0)
This commit is contained in:
Serhiy Storchaka 2023-07-25 14:15:14 +03:00 committed by GitHub
parent 058741cc39
commit b8b3e6afc0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 95 additions and 1 deletions

View file

@ -5120,6 +5120,9 @@ unicode_decode_utf8(const char *s, Py_ssize_t size,
}
s += ascii_decode(s, end, PyUnicode_1BYTE_DATA(u));
if (s == end) {
if (consumed) {
*consumed = size;
}
return u;
}