File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1751,8 +1751,8 @@ UnicodeTranslateError_str(PyObject *self)
17511751 if (reason_str == NULL )
17521752 goto done ;
17531753
1754- if (uself -> start < PyUnicode_GET_SIZE (uself -> object ) && uself -> end == uself -> start + 1 ) {
1755- int badchar = ( int ) PyUnicode_AS_UNICODE ( uself -> object )[ uself -> start ] ;
1754+ if (uself -> start < PyUnicode_GET_LENGTH (uself -> object ) && uself -> end == uself -> start + 1 ) {
1755+ Py_UCS4 badchar = PyUnicode_ReadChar ( uself -> object , uself -> start ) ;
17561756 const char * fmt ;
17571757 if (badchar <= 0xff )
17581758 fmt = "can't translate character '\\x%02x' in position %zd: %U" ;
@@ -1762,7 +1762,7 @@ UnicodeTranslateError_str(PyObject *self)
17621762 fmt = "can't translate character '\\U%08x' in position %zd: %U" ;
17631763 result = PyUnicode_FromFormat (
17641764 fmt ,
1765- badchar ,
1765+ ( int ) badchar ,
17661766 uself -> start ,
17671767 reason_str
17681768 );
You can’t perform that action at this time.
0 commit comments