Merge branch 'xbe-master'
This commit is contained in:
commit
93d004f4b0
@ -364,3 +364,9 @@ 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);
|
||||
|
||||
static mp_obj_t mp_builtin_id(mp_obj_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);
|
||||
|
@ -11,6 +11,7 @@ MP_DECLARE_CONST_FUN_OBJ(mp_builtin_chr_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(mp_builtin_divmod_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(mp_builtin_eval_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(mp_builtin_hash_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(mp_builtin_id_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(mp_builtin_isinstance_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(mp_builtin_issubclass_obj);
|
||||
MP_DECLARE_CONST_FUN_OBJ(mp_builtin_iter_obj);
|
||||
|
@ -57,6 +57,7 @@ Q(eval)
|
||||
Q(filter)
|
||||
Q(float)
|
||||
Q(hash)
|
||||
Q(id)
|
||||
Q(int)
|
||||
Q(isinstance)
|
||||
Q(issubclass)
|
||||
|
@ -144,6 +144,7 @@ void rt_init(void) {
|
||||
mp_map_add_qstr(&map_builtins, MP_QSTR_divmod, (mp_obj_t)&mp_builtin_divmod_obj);
|
||||
mp_map_add_qstr(&map_builtins, MP_QSTR_eval, (mp_obj_t)&mp_builtin_eval_obj);
|
||||
mp_map_add_qstr(&map_builtins, MP_QSTR_hash, (mp_obj_t)&mp_builtin_hash_obj);
|
||||
mp_map_add_qstr(&map_builtins, MP_QSTR_id, (mp_obj_t)&mp_builtin_id_obj);
|
||||
mp_map_add_qstr(&map_builtins, MP_QSTR_isinstance, (mp_obj_t)&mp_builtin_isinstance_obj);
|
||||
mp_map_add_qstr(&map_builtins, MP_QSTR_issubclass, (mp_obj_t)&mp_builtin_issubclass_obj);
|
||||
mp_map_add_qstr(&map_builtins, MP_QSTR_iter, (mp_obj_t)&mp_builtin_iter_obj);
|
||||
|
9
tests/basics/builtin_id.py
Normal file
9
tests/basics/builtin_id.py
Normal file
@ -0,0 +1,9 @@
|
||||
print(id(1) == id(2))
|
||||
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…
Reference in New Issue
Block a user