mirror of
https://github.com/python/cpython.git
synced 2025-08-29 21:25:01 +00:00
Issue #11461: Fix the incremental UTF-16 decoder. Original patch by
Amaury Forgeot d'Arc. Added tests for partial decoding of non-BMP characters.
This commit is contained in:
parent
dec798eb46
commit
48e188e573
3 changed files with 47 additions and 9 deletions
|
@ -3573,8 +3573,11 @@ PyUnicode_DecodeUTF16Stateful(const char *s,
|
|||
|
||||
/* UTF-16 code pair: */
|
||||
if (e - q < 2) {
|
||||
q -= 2;
|
||||
if (consumed)
|
||||
break;
|
||||
errmsg = "unexpected end of data";
|
||||
startinpos = (((const char *)q) - 2) - starts;
|
||||
startinpos = ((const char *)q) - starts;
|
||||
endinpos = ((const char *)e) - starts;
|
||||
goto utf16Error;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue