36
36
#include "py/runtime.h"
37
37
#include "py/stackctrl.h"
38
38
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 );
40
40
41
41
STATIC mp_obj_t mp_obj_new_bytes_iterator (mp_obj_t str );
42
42
STATIC 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) {
654
654
return MP_OBJ_FROM_PTR (res );
655
655
}
656
656
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 ) {
658
658
const mp_obj_type_t * self_type = mp_obj_get_type (args [0 ]);
659
659
mp_check_self (MP_OBJ_IS_STR_OR_BYTES (args [0 ]));
660
660
@@ -740,7 +740,7 @@ STATIC mp_obj_t str_endswith(size_t n_args, const mp_obj_t *args) {
740
740
741
741
enum { LSTRIP , RSTRIP , STRIP };
742
742
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 ) {
744
744
mp_check_self (MP_OBJ_IS_STR_OR_BYTES (args [0 ]));
745
745
const mp_obj_type_t * self_type = mp_obj_get_type (args [0 ]);
746
746
@@ -892,7 +892,7 @@ STATIC NORETURN void terse_str_format_value_error(void) {
892
892
#define terse_str_format_value_error ()
893
893
#endif
894
894
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 ) {
896
896
vstr_t vstr ;
897
897
mp_print_t print ;
898
898
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
1344
1344
return mp_obj_new_str_from_vstr (& mp_type_str , & vstr );
1345
1345
}
1346
1346
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 ) {
1348
1348
mp_check_self (MP_OBJ_IS_STR_OR_BYTES (pattern ));
1349
1349
1350
1350
GET_STR_DATA_LEN (pattern , str , len );
1351
1351
const byte * start_str = str ;
1352
1352
bool is_bytes = MP_OBJ_IS_TYPE (pattern , & mp_type_bytes );
1353
- int arg_i = 0 ;
1353
+ size_t arg_i = 0 ;
1354
1354
vstr_t vstr ;
1355
1355
mp_print_t print ;
1356
1356
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
1409
1409
int width = 0 ;
1410
1410
if (str < top ) {
1411
1411
if (* str == '*' ) {
1412
- if (( uint ) arg_i >= n_args ) {
1412
+ if (arg_i >= n_args ) {
1413
1413
goto not_enough_args ;
1414
1414
}
1415
1415
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
1422
1422
if (str < top && * str == '.' ) {
1423
1423
if (++ str < top ) {
1424
1424
if (* str == '*' ) {
1425
- if (( uint ) arg_i >= n_args ) {
1425
+ if (arg_i >= n_args ) {
1426
1426
goto not_enough_args ;
1427
1427
}
1428
1428
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
1445
1445
1446
1446
// Tuple value lookup
1447
1447
if (arg == MP_OBJ_NULL ) {
1448
- if (( uint ) arg_i >= n_args ) {
1448
+ if (arg_i >= n_args ) {
1449
1449
not_enough_args :
1450
1450
mp_raise_TypeError ("not enough arguments for format string" );
1451
1451
}
@@ -1533,7 +1533,7 @@ STATIC mp_obj_t str_modulo_format(mp_obj_t pattern, mp_uint_t n_args, const mp_o
1533
1533
}
1534
1534
}
1535
1535
1536
- if (( uint ) arg_i != n_args ) {
1536
+ if (arg_i != n_args ) {
1537
1537
mp_raise_TypeError ("not all arguments converted during string formatting" );
1538
1538
}
1539
1539
0 commit comments