@@ -26,20 +26,19 @@ STATIC void check_nargs(mp_obj_fun_native_t *self, int n_args, int n_kw) {
2626
2727 if (self -> n_args_min == self -> n_args_max ) {
2828 if (n_args != self -> n_args_min ) {
29- nlr_jump (mp_obj_new_exception_msg_2_args (MP_QSTR_TypeError ,
29+ nlr_jump (mp_obj_new_exception_msg_varg (MP_QSTR_TypeError ,
3030 "function takes %d positional arguments but %d were given" ,
31- (const char * )(machine_int_t )self -> n_args_min ,
32- (const char * )(machine_int_t )n_args ));
31+ self -> n_args_min , n_args ));
3332 }
3433 } else {
3534 if (n_args < self -> n_args_min ) {
36- nlr_jump (mp_obj_new_exception_msg_1_arg (MP_QSTR_TypeError ,
35+ nlr_jump (mp_obj_new_exception_msg_varg (MP_QSTR_TypeError ,
3736 "<fun name>() missing %d required positional arguments: <list of names of params>" ,
38- ( const char * )( machine_int_t )( self -> n_args_min - n_args ) ));
37+ self -> n_args_min - n_args ));
3938 } else if (n_args > self -> n_args_max ) {
40- nlr_jump (mp_obj_new_exception_msg_2_args (MP_QSTR_TypeError ,
39+ nlr_jump (mp_obj_new_exception_msg_varg (MP_QSTR_TypeError ,
4140 "<fun name> expected at most %d arguments, got %d" ,
42- ( void * )( machine_int_t ) self -> n_args_max , ( void * )( machine_int_t ) n_args ));
41+ self -> n_args_max , n_args ));
4342 }
4443 }
4544}
@@ -144,7 +143,7 @@ STATIC mp_obj_t fun_bc_call(mp_obj_t self_in, uint n_args, uint n_kw, const mp_o
144143 mp_obj_fun_bc_t * self = self_in ;
145144
146145 if (n_args < self -> n_args - self -> n_def_args || n_args > self -> n_args ) {
147- nlr_jump (mp_obj_new_exception_msg_2_args (MP_QSTR_TypeError , "function takes %d positional arguments but %d were given" , ( const char * )( machine_int_t ) self -> n_args , ( const char * )( machine_int_t ) n_args ));
146+ nlr_jump (mp_obj_new_exception_msg_varg (MP_QSTR_TypeError , "function takes %d positional arguments but %d were given" , self -> n_args , n_args ));
148147 }
149148 if (n_kw != 0 ) {
150149 nlr_jump (mp_obj_new_exception_msg (MP_QSTR_TypeError , "function does not take keyword arguments" ));
@@ -253,7 +252,7 @@ STATIC mp_obj_t fun_asm_call(mp_obj_t self_in, uint n_args, uint n_kw, const mp_
253252 mp_obj_fun_asm_t * self = self_in ;
254253
255254 if (n_args != self -> n_args ) {
256- nlr_jump (mp_obj_new_exception_msg_2_args (MP_QSTR_TypeError , "function takes %d positional arguments but %d were given" , ( const char * )( machine_int_t ) self -> n_args , ( const char * )( machine_int_t ) n_args ));
255+ nlr_jump (mp_obj_new_exception_msg_varg (MP_QSTR_TypeError , "function takes %d positional arguments but %d were given" , self -> n_args , n_args ));
257256 }
258257 if (n_kw != 0 ) {
259258 nlr_jump (mp_obj_new_exception_msg (MP_QSTR_TypeError , "function does not take keyword arguments" ));
0 commit comments