File tree Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -424,7 +424,7 @@ static mp_obj_t int_to_bytes(size_t n_args, const mp_obj_t *args) {
424
424
// TODO: Support signed (currently behaves as if signed=(val < 0))
425
425
bool overflow ;
426
426
427
- mp_int_t dlen = mp_obj_get_int (args [1 ]);
427
+ mp_int_t dlen = n_args < 2 ? 1 : mp_obj_get_int (args [1 ]);
428
428
if (dlen < 0 ) {
429
429
mp_raise_ValueError (NULL );
430
430
}
@@ -468,7 +468,7 @@ static mp_obj_t int_to_bytes(size_t n_args, const mp_obj_t *args) {
468
468
469
469
return mp_obj_new_bytes_from_vstr (& vstr );
470
470
}
471
- static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN (int_to_bytes_obj , 2 , 4 , int_to_bytes ) ;
471
+ static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN (int_to_bytes_obj , 1 , 4 , int_to_bytes ) ;
472
472
473
473
static const mp_rom_map_elem_t int_locals_dict_table [] = {
474
474
{ MP_ROM_QSTR (MP_QSTR_from_bytes ), MP_ROM_PTR (& int_from_bytes_obj ) },
You can’t perform that action at this time.
0 commit comments