Skip to content

Commit

Permalink
py/objint.c: mark CIRCUITPY-CHANGEs
Browse files Browse the repository at this point in the history
  • Loading branch information
dhalbert committed Jan 6, 2025
1 parent 1d90a0e commit d0b8646
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions py/objint.c
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,7 @@ static mp_obj_t int_from_bytes(size_t n_args, const mp_obj_t *pos_args, mp_map_t
enum { ARG_bytes, ARG_byteorder, ARG_signed };
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_bytes, MP_ARG_REQUIRED | MP_ARG_OBJ, {.u_obj = NULL} },
// CIRCUITPY-CHANGE: not required and given a default value.
{ MP_QSTR_byteorder, MP_ARG_OBJ, {.u_obj = MP_OBJ_NEW_QSTR(MP_QSTR_big)} },
{ MP_QSTR_signed, MP_ARG_KW_ONLY | MP_ARG_BOOL, {.u_bool = false} },
};
Expand Down Expand Up @@ -527,6 +528,7 @@ static mp_obj_t int_from_bytes(size_t n_args, const mp_obj_t *pos_args, mp_map_t
return mp_obj_new_int_from_uint(value);
}

// CIRCUITPY-CHANGE: only two required args.
static MP_DEFINE_CONST_FUN_OBJ_KW(int_from_bytes_fun_obj, 2, int_from_bytes);
static MP_DEFINE_CONST_CLASSMETHOD_OBJ(int_from_bytes_obj, MP_ROM_PTR(&int_from_bytes_fun_obj));

Expand All @@ -535,6 +537,7 @@ static mp_obj_t int_to_bytes(size_t n_args, const mp_obj_t *pos_args, mp_map_t *
enum { ARG_length, ARG_byteorder, ARG_signed };
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_length, MP_ARG_REQUIRED | MP_ARG_INT, {.u_int = 0} },
// CIRCUITPY-CHANGE: not required and given a default value.
{ MP_QSTR_byteorder, MP_ARG_OBJ, {.u_obj = MP_OBJ_NEW_QSTR(MP_QSTR_big)} },
{ MP_QSTR_signed, MP_ARG_KW_ONLY | MP_ARG_BOOL, {.u_bool = false} },
};
Expand Down Expand Up @@ -575,6 +578,7 @@ static mp_obj_t int_to_bytes(size_t n_args, const mp_obj_t *pos_args, mp_map_t *

return mp_obj_new_bytes_from_vstr(&vstr);
}
// CIRCUITPY-CHANGE: only two required args.
static MP_DEFINE_CONST_FUN_OBJ_KW(int_to_bytes_obj, 2, int_to_bytes);

static const mp_rom_map_elem_t int_locals_dict_table[] = {
Expand Down

0 comments on commit d0b8646

Please sign in to comment.