Change id to return signed integer.
This commit is contained in:
parent
0ebf8534ab
commit
330cf6d04a
@ -366,7 +366,7 @@ static mp_obj_t mp_builtin_bytes(uint n_args, const mp_obj_t *args) {
|
|||||||
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_builtin_bytes_obj, 1, 3, mp_builtin_bytes);
|
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_builtin_bytes_obj, 1, 3, mp_builtin_bytes);
|
||||||
|
|
||||||
static mp_obj_t mp_builtin_id(mp_obj_t o_in) {
|
static mp_obj_t mp_builtin_id(mp_obj_t o_in) {
|
||||||
return mp_obj_new_int_from_uint((machine_uint_t)o_in);
|
return mp_obj_new_int((machine_int_t)o_in);
|
||||||
}
|
}
|
||||||
|
|
||||||
MP_DEFINE_CONST_FUN_OBJ_1(mp_builtin_id_obj, mp_builtin_id);
|
MP_DEFINE_CONST_FUN_OBJ_1(mp_builtin_id_obj, mp_builtin_id);
|
||||||
|
@ -1,2 +1,9 @@
|
|||||||
print(id(1) == id(2))
|
print(id(1) == id(2))
|
||||||
print(id(None) == id(None))
|
print(id(None) == id(None))
|
||||||
|
print(id([]) == id([]))
|
||||||
|
|
||||||
|
l = [1, 2]
|
||||||
|
print(id(l) == id(l))
|
||||||
|
|
||||||
|
f = lambda:None
|
||||||
|
print(id(f) == id(f))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user