diff options
author | Damien George <damien.p.george@gmail.com> | 2015-01-11 21:07:15 +0000 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2015-01-11 21:07:15 +0000 |
commit | e233a55a296a981bce5fe3a7c20049bea46e3a16 (patch) | |
tree | 0df8fbe6242485d59dbf5621976ba209005a49c0 /py/objfun.c | |
parent | c38dc3ccc76d1a9bf867704f43ea5d15da3fea7b (diff) | |
download | micropython-e233a55a296a981bce5fe3a7c20049bea46e3a16.tar.gz micropython-e233a55a296a981bce5fe3a7c20049bea46e3a16.zip |
py: Remove unnecessary BINARY_OP_EQUAL code that just checks pointers.
Previous patch c38dc3ccc76d1a9bf867704f43ea5d15da3fea7b allowed any
object to be compared with any other, using pointer comparison for a
fallback. As such, existing code which checked for this case is no
longer needed.
Diffstat (limited to 'py/objfun.c')
-rw-r--r-- | py/objfun.c | 19 |
1 files changed, 3 insertions, 16 deletions
diff --git a/py/objfun.c b/py/objfun.c index b86d6f8dc6..3f26915223 100644 --- a/py/objfun.c +++ b/py/objfun.c @@ -43,17 +43,9 @@ #define DEBUG_printf(...) (void)0 #endif -// This binary_op method is used for all function types, and is also -// used to determine if an object is of generic function type. -mp_obj_t mp_obj_fun_binary_op(mp_uint_t op, mp_obj_t lhs_in, mp_obj_t rhs_in) { - switch (op) { - case MP_BINARY_OP_EQUAL: - // These objects can be equal only if it's the same underlying structure, - // we don't even need to check for 2nd arg type. - return MP_BOOL(lhs_in == rhs_in); - } - return MP_OBJ_NULL; // op not supported -} +// Note: the "name" entry in mp_obj_type_t for a function type must be +// MP_QSTR_function because it is used to determine if an object is of generic +// function type. /******************************************************************************/ /* builtin functions */ @@ -109,7 +101,6 @@ const mp_obj_type_t mp_type_fun_builtin = { { &mp_type_type }, .name = MP_QSTR_function, .call = fun_builtin_call, - .binary_op = mp_obj_fun_binary_op, }; /******************************************************************************/ @@ -264,7 +255,6 @@ const mp_obj_type_t mp_type_fun_bc = { .print = fun_bc_print, #endif .call = fun_bc_call, - .binary_op = mp_obj_fun_binary_op, }; mp_obj_t mp_obj_new_fun_bc(mp_uint_t scope_flags, mp_uint_t n_pos_args, mp_uint_t n_kwonly_args, mp_obj_t def_args_in, mp_obj_t def_kw_args, const byte *code) { @@ -345,7 +335,6 @@ STATIC const mp_obj_type_t mp_type_fun_native = { { &mp_type_type }, .name = MP_QSTR_function, .call = fun_native_call, - .binary_op = mp_obj_fun_binary_op, }; mp_obj_t mp_obj_new_fun_native(mp_uint_t n_args, void *fun_data) { @@ -404,7 +393,6 @@ STATIC const mp_obj_type_t mp_type_fun_viper = { { &mp_type_type }, .name = MP_QSTR_function, .call = fun_viper_call, - .binary_op = mp_obj_fun_binary_op, }; mp_obj_t mp_obj_new_fun_viper(mp_uint_t n_args, void *fun_data, mp_uint_t type_sig) { @@ -515,7 +503,6 @@ STATIC const mp_obj_type_t mp_type_fun_asm = { { &mp_type_type }, .name = MP_QSTR_function, .call = fun_asm_call, - .binary_op = mp_obj_fun_binary_op, }; mp_obj_t mp_obj_new_fun_asm(mp_uint_t n_args, void *fun_data) { |