File tree Expand file tree Collapse file tree 1 file changed +2
-3
lines changed Expand file tree Collapse file tree 1 file changed +2
-3
lines changed Original file line number Diff line number Diff line change @@ -422,14 +422,13 @@ static MP_DEFINE_CONST_CLASSMETHOD_OBJ(int_from_bytes_obj, MP_ROM_PTR(&int_from_
422
422
423
423
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
- (void )n_args ;
426
425
bool overflow ;
427
426
428
427
mp_int_t dlen = mp_obj_get_int (args [1 ]);
429
428
if (dlen < 0 ) {
430
429
mp_raise_ValueError (NULL );
431
430
}
432
- bool big_endian = args [2 ] != MP_OBJ_NEW_QSTR (MP_QSTR_little );
431
+ bool big_endian = n_args < 3 || args [2 ] != MP_OBJ_NEW_QSTR (MP_QSTR_little );
433
432
434
433
vstr_t vstr ;
435
434
vstr_init_len (& vstr , dlen );
@@ -469,7 +468,7 @@ static mp_obj_t int_to_bytes(size_t n_args, const mp_obj_t *args) {
469
468
470
469
return mp_obj_new_bytes_from_vstr (& vstr );
471
470
}
472
- static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN (int_to_bytes_obj , 3 , 4 , int_to_bytes ) ;
471
+ static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN (int_to_bytes_obj , 2 , 4 , int_to_bytes ) ;
473
472
474
473
static const mp_rom_map_elem_t int_locals_dict_table [] = {
475
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