py/obj: Remove mp_generic_unary_op().
Since converting to variable sized slots in mp_obj_type_t, we can now reduce the code size a bit by removing mp_generic_unary_op() and the corresponding slots where it is used. Instead we just implement the generic `__hash__` operation in the runtime. Signed-off-by: David Lechner <david@pybricks.com>
This commit is contained in:
committed by
Damien George
parent
53cb073571
commit
eaccaa3677
@@ -81,8 +81,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
|
||||
MP_QSTR_generator,
|
||||
MP_TYPE_FLAG_BINDS_SELF,
|
||||
GEN_WRAP_TYPE_ATTR
|
||||
call, gen_wrap_call,
|
||||
unary_op, mp_generic_unary_op
|
||||
call, gen_wrap_call
|
||||
);
|
||||
|
||||
/******************************************************************************/
|
||||
@@ -136,7 +135,7 @@ STATIC mp_obj_t native_gen_wrap_call(mp_obj_t self_in, size_t n_args, size_t n_k
|
||||
}
|
||||
|
||||
#if MICROPY_PY_FUNCTION_ATTRS
|
||||
#define NATIVE_GEN_WRAP_TYPE_ATTR attr, mp_obj_fun_bc_attr,
|
||||
#define NATIVE_GEN_WRAP_TYPE_ATTR , attr, mp_obj_fun_bc_attr
|
||||
#else
|
||||
#define NATIVE_GEN_WRAP_TYPE_ATTR
|
||||
#endif
|
||||
@@ -145,9 +144,8 @@ MP_DEFINE_CONST_OBJ_TYPE(
|
||||
mp_type_native_gen_wrap,
|
||||
MP_QSTR_generator,
|
||||
MP_TYPE_FLAG_BINDS_SELF,
|
||||
call, native_gen_wrap_call,
|
||||
call, native_gen_wrap_call
|
||||
NATIVE_GEN_WRAP_TYPE_ATTR
|
||||
unary_op, mp_generic_unary_op
|
||||
);
|
||||
|
||||
#endif // MICROPY_EMIT_NATIVE
|
||||
@@ -370,7 +368,6 @@ MP_DEFINE_CONST_OBJ_TYPE(
|
||||
MP_QSTR_generator,
|
||||
MP_TYPE_FLAG_ITER_IS_ITERNEXT,
|
||||
print, gen_instance_print,
|
||||
unary_op, mp_generic_unary_op,
|
||||
iter, gen_instance_iternext,
|
||||
locals_dict, &gen_instance_locals_dict
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user