@@ -490,7 +490,8 @@ static mp_obj_t int_from_bytes(size_t n_args, const mp_obj_t *pos_args, mp_map_t
490
490
enum { ARG_bytes , ARG_byteorder , ARG_signed };
491
491
static const mp_arg_t allowed_args [] = {
492
492
{ MP_QSTR_bytes , MP_ARG_REQUIRED | MP_ARG_OBJ , {.u_obj = NULL } },
493
- { MP_QSTR_byteorder , MP_ARG_REQUIRED | MP_ARG_OBJ , {.u_obj = NULL } },
493
+ // CIRCUITPY-CHANGE: not required and given a default value.
494
+ { MP_QSTR_byteorder , MP_ARG_OBJ , {.u_obj = MP_OBJ_NEW_QSTR (MP_QSTR_big )} },
494
495
{ MP_QSTR_signed , MP_ARG_KW_ONLY | MP_ARG_BOOL , {.u_bool = false} },
495
496
};
496
497
mp_arg_val_t args [MP_ARRAY_SIZE (allowed_args )];
@@ -527,15 +528,17 @@ static mp_obj_t int_from_bytes(size_t n_args, const mp_obj_t *pos_args, mp_map_t
527
528
return mp_obj_new_int_from_uint (value );
528
529
}
529
530
530
- static MP_DEFINE_CONST_FUN_OBJ_KW (int_from_bytes_fun_obj , 3 , int_from_bytes ) ;
531
+ // CIRCUITPY-CHANGE: only two required args.
532
+ static MP_DEFINE_CONST_FUN_OBJ_KW (int_from_bytes_fun_obj , 2 , int_from_bytes ) ;
531
533
static MP_DEFINE_CONST_CLASSMETHOD_OBJ (int_from_bytes_obj , MP_ROM_PTR (& int_from_bytes_fun_obj )) ;
532
534
533
535
// CIRCUITPY-CHANGE: supports signed
534
536
static mp_obj_t int_to_bytes (size_t n_args , const mp_obj_t * pos_args , mp_map_t * kw_args ) {
535
537
enum { ARG_length , ARG_byteorder , ARG_signed };
536
538
static const mp_arg_t allowed_args [] = {
537
539
{ MP_QSTR_length , MP_ARG_REQUIRED | MP_ARG_INT , {.u_int = 0 } },
538
- { MP_QSTR_byteorder , MP_ARG_REQUIRED | MP_ARG_OBJ , {.u_obj = MP_OBJ_NULL } },
540
+ // CIRCUITPY-CHANGE: not required and given a default value.
541
+ { MP_QSTR_byteorder , MP_ARG_OBJ , {.u_obj = MP_OBJ_NEW_QSTR (MP_QSTR_big )} },
539
542
{ MP_QSTR_signed , MP_ARG_KW_ONLY | MP_ARG_BOOL , {.u_bool = false} },
540
543
};
541
544
mp_arg_val_t args [MP_ARRAY_SIZE (allowed_args )];
@@ -575,7 +578,8 @@ static mp_obj_t int_to_bytes(size_t n_args, const mp_obj_t *pos_args, mp_map_t *
575
578
576
579
return mp_obj_new_bytes_from_vstr (& vstr );
577
580
}
578
- static MP_DEFINE_CONST_FUN_OBJ_KW (int_to_bytes_obj , 3 , int_to_bytes ) ;
581
+ // CIRCUITPY-CHANGE: only two required args.
582
+ static MP_DEFINE_CONST_FUN_OBJ_KW (int_to_bytes_obj , 2 , int_to_bytes ) ;
579
583
580
584
static const mp_rom_map_elem_t int_locals_dict_table [] = {
581
585
// CIRCUITPY-CHANGE
0 commit comments