summaryrefslogtreecommitdiffstats
path: root/Objects/unicodeobject.c
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2023-07-25 11:15:14 (GMT)
committerGitHub <noreply@github.com>2023-07-25 11:15:14 (GMT)
commitb8b3e6afc0a48c3cbb7c36d2f73e332edcd6058c (patch)
treefdced2a6b57abb0be7f710d4c70320deec48ce57 /Objects/unicodeobject.c
parent058741cc39dd2b63907931e2b626f7428ba13253 (diff)
downloadcpython-b8b3e6afc0a48c3cbb7c36d2f73e332edcd6058c.zip
cpython-b8b3e6afc0a48c3cbb7c36d2f73e332edcd6058c.tar.gz
cpython-b8b3e6afc0a48c3cbb7c36d2f73e332edcd6058c.tar.bz2
[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 f08e52ccb027f6f703302b8c1a82db9fd3934270)
Diffstat (limited to 'Objects/unicodeobject.c')
-rw-r--r--Objects/unicodeobject.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index 50deefe..ffa8b98 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -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;
}