mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
Issue #25301: Fix compatibility with ISO C90
This commit is contained in:
parent
1d65d9192d
commit
74e8fac3c8
1 changed files with 5 additions and 1 deletions
|
@ -4795,9 +4795,12 @@ PyUnicode_DecodeUTF8Stateful(const char *s,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case _Py_ERROR_SURROGATEESCAPE:
|
case _Py_ERROR_SURROGATEESCAPE:
|
||||||
|
{
|
||||||
|
Py_ssize_t i;
|
||||||
|
|
||||||
if (_PyUnicodeWriter_PrepareKind(&writer, PyUnicode_2BYTE_KIND) < 0)
|
if (_PyUnicodeWriter_PrepareKind(&writer, PyUnicode_2BYTE_KIND) < 0)
|
||||||
goto onError;
|
goto onError;
|
||||||
for (Py_ssize_t i=startinpos; i<endinpos; i++) {
|
for (i=startinpos; i<endinpos; i++) {
|
||||||
ch = (Py_UCS4)(unsigned char)(starts[i]);
|
ch = (Py_UCS4)(unsigned char)(starts[i]);
|
||||||
PyUnicode_WRITE(writer.kind, writer.data, writer.pos,
|
PyUnicode_WRITE(writer.kind, writer.data, writer.pos,
|
||||||
ch + 0xdc00);
|
ch + 0xdc00);
|
||||||
|
@ -4805,6 +4808,7 @@ PyUnicode_DecodeUTF8Stateful(const char *s,
|
||||||
}
|
}
|
||||||
s += (endinpos - startinpos);
|
s += (endinpos - startinpos);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if (unicode_decode_call_errorhandler_writer(
|
if (unicode_decode_call_errorhandler_writer(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue