@@ -1011,17 +1011,19 @@ _PyUnicode_Dump(PyObject *op)
10111011 }
10121012 else
10131013 data = unicode -> data .any ;
1014- printf ("%s: len=%zu, " ,unicode_kind_name (op ), ascii -> length );
1014+ printf ("%s: len=%" PY_FORMAT_SIZE_T "u, " ,
1015+ unicode_kind_name (op ), ascii -> length );
10151016
10161017 if (ascii -> wstr == data )
10171018 printf ("shared " );
10181019 printf ("wstr=%p" , ascii -> wstr );
10191020
10201021 if (!(ascii -> state .ascii == 1 && ascii -> state .compact == 1 )) {
1021- printf (" (%zu ), " , compact -> wstr_length );
1022+ printf (" (%" PY_FORMAT_SIZE_T "u ), " , compact -> wstr_length );
10221023 if (!ascii -> state .compact && compact -> utf8 == unicode -> data .any )
10231024 printf ("shared " );
1024- printf ("utf8=%p (%zu)" , compact -> utf8 , compact -> utf8_length );
1025+ printf ("utf8=%p (%" PY_FORMAT_SIZE_T "u)" ,
1026+ compact -> utf8 , compact -> utf8_length );
10251027 }
10261028 printf (", data=%p\n" , data );
10271029}
@@ -1370,8 +1372,9 @@ PyUnicode_CopyCharacters(PyObject *to, Py_ssize_t to_start,
13701372 how_many = Py_MIN (PyUnicode_GET_LENGTH (from ), how_many );
13711373 if (to_start + how_many > PyUnicode_GET_LENGTH (to )) {
13721374 PyErr_Format (PyExc_SystemError ,
1373- "Cannot write %zi characters at %zi "
1374- "in a string of %zi characters" ,
1375+ "Cannot write %" PY_FORMAT_SIZE_T "i characters at %"
1376+ PY_FORMAT_SIZE_T "i in a string of %"
1377+ PY_FORMAT_SIZE_T "i characters" ,
13751378 how_many , to_start , PyUnicode_GET_LENGTH (to ));
13761379 return -1 ;
13771380 }
@@ -4080,7 +4083,9 @@ unicode_decode_call_errorhandler_wchar(
40804083 if (newpos < 0 )
40814084 newpos = insize + newpos ;
40824085 if (newpos < 0 || newpos > insize ) {
4083- PyErr_Format (PyExc_IndexError , "position %zd from error handler out of bounds" , newpos );
4086+ PyErr_Format (PyExc_IndexError ,
4087+ "position %" PY_FORMAT_SIZE_T
4088+ "d from error handler out of bounds" , newpos );
40844089 goto onError ;
40854090 }
40864091
@@ -4173,7 +4178,9 @@ unicode_decode_call_errorhandler_writer(
41734178 if (newpos < 0 )
41744179 newpos = insize + newpos ;
41754180 if (newpos < 0 || newpos > insize ) {
4176- PyErr_Format (PyExc_IndexError , "position %zd from error handler out of bounds" , newpos );
4181+ PyErr_Format (PyExc_IndexError ,
4182+ "position %" PY_FORMAT_SIZE_T
4183+ "d from error handler out of bounds" , newpos );
41774184 goto onError ;
41784185 }
41794186
@@ -6436,7 +6443,9 @@ unicode_encode_call_errorhandler(const char *errors,
64366443 if (* newpos < 0 )
64376444 * newpos = len + * newpos ;
64386445 if (* newpos < 0 || * newpos > len ) {
6439- PyErr_Format (PyExc_IndexError , "position %zd from error handler out of bounds" , * newpos );
6446+ PyErr_Format (PyExc_IndexError ,
6447+ "position %" PY_FORMAT_SIZE_T
6448+ "d from error handler out of bounds" , * newpos );
64406449 Py_DECREF (restuple );
64416450 return NULL ;
64426451 }
@@ -8459,7 +8468,9 @@ unicode_translate_call_errorhandler(const char *errors,
84598468 else
84608469 * newpos = i_newpos ;
84618470 if (* newpos < 0 || * newpos > PyUnicode_GET_LENGTH (unicode )) {
8462- PyErr_Format (PyExc_IndexError , "position %zd from error handler out of bounds" , * newpos );
8471+ PyErr_Format (PyExc_IndexError ,
8472+ "position %" PY_FORMAT_SIZE_T
8473+ "d from error handler out of bounds" , * newpos );
84638474 Py_DECREF (restuple );
84648475 return NULL ;
84658476 }
@@ -9741,7 +9752,8 @@ PyUnicode_Join(PyObject *separator, PyObject *seq)
97419752 item = items [i ];
97429753 if (!PyUnicode_Check (item )) {
97439754 PyErr_Format (PyExc_TypeError ,
9744- "sequence item %zd: expected str instance,"
9755+ "sequence item %" PY_FORMAT_SIZE_T
9756+ "d: expected str instance,"
97459757 " %.80s found" ,
97469758 i , Py_TYPE (item )-> tp_name );
97479759 goto onError ;
@@ -14440,7 +14452,7 @@ unicode_format_arg_format(struct unicode_formatter_t *ctx,
1444014452 default :
1444114453 PyErr_Format (PyExc_ValueError ,
1444214454 "unsupported format character '%c' (0x%x) "
14443- "at index %zd " ,
14455+ "at index %" PY_FORMAT_SIZE_T "d " ,
1444414456 (31 <=arg -> ch && arg -> ch <=126 ) ? (char )arg -> ch : '?' ,
1444514457 (int )arg -> ch ,
1444614458 ctx -> fmtpos - 1 );
0 commit comments