3636#include "py/runtime.h"
3737#include "py/stackctrl.h"
3838
39- STATIC mp_obj_t str_modulo_format (mp_obj_t pattern , mp_uint_t n_args , const mp_obj_t * args , mp_obj_t dict );
39+ STATIC mp_obj_t str_modulo_format (mp_obj_t pattern , size_t n_args , const mp_obj_t * args , mp_obj_t dict );
4040
4141STATIC mp_obj_t mp_obj_new_bytes_iterator (mp_obj_t str );
4242STATIC NORETURN void bad_implicit_conversion (mp_obj_t self_in );
@@ -654,7 +654,7 @@ STATIC mp_obj_t str_rsplit(size_t n_args, const mp_obj_t *args) {
654654 return MP_OBJ_FROM_PTR (res );
655655}
656656
657- STATIC mp_obj_t str_finder (mp_uint_t n_args , const mp_obj_t * args , mp_int_t direction , bool is_index ) {
657+ STATIC mp_obj_t str_finder (size_t n_args , const mp_obj_t * args , mp_int_t direction , bool is_index ) {
658658 const mp_obj_type_t * self_type = mp_obj_get_type (args [0 ]);
659659 mp_check_self (MP_OBJ_IS_STR_OR_BYTES (args [0 ]));
660660
@@ -740,7 +740,7 @@ STATIC mp_obj_t str_endswith(size_t n_args, const mp_obj_t *args) {
740740
741741enum { LSTRIP , RSTRIP , STRIP };
742742
743- STATIC mp_obj_t str_uni_strip (int type , mp_uint_t n_args , const mp_obj_t * args ) {
743+ STATIC mp_obj_t str_uni_strip (int type , size_t n_args , const mp_obj_t * args ) {
744744 mp_check_self (MP_OBJ_IS_STR_OR_BYTES (args [0 ]));
745745 const mp_obj_type_t * self_type = mp_obj_get_type (args [0 ]);
746746
@@ -892,7 +892,7 @@ STATIC NORETURN void terse_str_format_value_error(void) {
892892#define terse_str_format_value_error ()
893893#endif
894894
895- STATIC vstr_t mp_obj_str_format_helper (const char * str , const char * top , int * arg_i , mp_uint_t n_args , const mp_obj_t * args , mp_map_t * kwargs ) {
895+ STATIC vstr_t mp_obj_str_format_helper (const char * str , const char * top , int * arg_i , size_t n_args , const mp_obj_t * args , mp_map_t * kwargs ) {
896896 vstr_t vstr ;
897897 mp_print_t print ;
898898 vstr_init_print (& vstr , 16 , & print );
@@ -1344,13 +1344,13 @@ mp_obj_t mp_obj_str_format(size_t n_args, const mp_obj_t *args, mp_map_t *kwargs
13441344 return mp_obj_new_str_from_vstr (& mp_type_str , & vstr );
13451345}
13461346
1347- STATIC mp_obj_t str_modulo_format (mp_obj_t pattern , mp_uint_t n_args , const mp_obj_t * args , mp_obj_t dict ) {
1347+ STATIC mp_obj_t str_modulo_format (mp_obj_t pattern , size_t n_args , const mp_obj_t * args , mp_obj_t dict ) {
13481348 mp_check_self (MP_OBJ_IS_STR_OR_BYTES (pattern ));
13491349
13501350 GET_STR_DATA_LEN (pattern , str , len );
13511351 const byte * start_str = str ;
13521352 bool is_bytes = MP_OBJ_IS_TYPE (pattern , & mp_type_bytes );
1353- int arg_i = 0 ;
1353+ size_t arg_i = 0 ;
13541354 vstr_t vstr ;
13551355 mp_print_t print ;
13561356 vstr_init_print (& vstr , 16 , & print );
@@ -1409,7 +1409,7 @@ STATIC mp_obj_t str_modulo_format(mp_obj_t pattern, mp_uint_t n_args, const mp_o
14091409 int width = 0 ;
14101410 if (str < top ) {
14111411 if (* str == '*' ) {
1412- if (( uint ) arg_i >= n_args ) {
1412+ if (arg_i >= n_args ) {
14131413 goto not_enough_args ;
14141414 }
14151415 width = mp_obj_get_int (args [arg_i ++ ]);
@@ -1422,7 +1422,7 @@ STATIC mp_obj_t str_modulo_format(mp_obj_t pattern, mp_uint_t n_args, const mp_o
14221422 if (str < top && * str == '.' ) {
14231423 if (++ str < top ) {
14241424 if (* str == '*' ) {
1425- if (( uint ) arg_i >= n_args ) {
1425+ if (arg_i >= n_args ) {
14261426 goto not_enough_args ;
14271427 }
14281428 prec = mp_obj_get_int (args [arg_i ++ ]);
@@ -1445,7 +1445,7 @@ STATIC mp_obj_t str_modulo_format(mp_obj_t pattern, mp_uint_t n_args, const mp_o
14451445
14461446 // Tuple value lookup
14471447 if (arg == MP_OBJ_NULL ) {
1448- if (( uint ) arg_i >= n_args ) {
1448+ if (arg_i >= n_args ) {
14491449not_enough_args :
14501450 mp_raise_TypeError ("not enough arguments for format string" );
14511451 }
@@ -1533,7 +1533,7 @@ STATIC mp_obj_t str_modulo_format(mp_obj_t pattern, mp_uint_t n_args, const mp_o
15331533 }
15341534 }
15351535
1536- if (( uint ) arg_i != n_args ) {
1536+ if (arg_i != n_args ) {
15371537 mp_raise_TypeError ("not all arguments converted during string formatting" );
15381538 }
15391539
0 commit comments