summaryrefslogtreecommitdiff
path: root/py/objboundmeth.c
diff options
context:
space:
mode:
authorDamien George <damien@micropython.org>2025-07-25 00:09:18 +1000
committerDamien George <damien@micropython.org>2025-07-31 11:38:35 +1000
commit241ee163c0c8a33267c699af59492641d0770f30 (patch)
treedb12b3ab753a1a40777a24544a100a9d0f8a121a /py/objboundmeth.c
parentfdbd23268d69d77a411aa5c2d792eaf5e77d454a (diff)
py/objboundmeth: Add option to use mp_is_equal instead of == comparison.
This option is needed for ports such as webassembly where objects are proxied and can be identical without being the same C pointer. Signed-off-by: Damien George <damien@micropython.org>
Diffstat (limited to 'py/objboundmeth.c')
-rw-r--r--py/objboundmeth.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/py/objboundmeth.c b/py/objboundmeth.c
index e3503ff15..6df67f7bf 100644
--- a/py/objboundmeth.c
+++ b/py/objboundmeth.c
@@ -102,7 +102,11 @@ static mp_obj_t bound_meth_binary_op(mp_binary_op_t op, mp_obj_t lhs_in, mp_obj_
}
mp_obj_bound_meth_t *lhs = MP_OBJ_TO_PTR(lhs_in);
mp_obj_bound_meth_t *rhs = MP_OBJ_TO_PTR(rhs_in);
+ #if MICROPY_PY_BOUND_METHOD_FULL_EQUALITY_CHECK
+ return mp_obj_new_bool(mp_obj_equal(lhs->self, rhs->self) && mp_obj_equal(lhs->meth, rhs->meth));
+ #else
return mp_obj_new_bool(lhs->self == rhs->self && lhs->meth == rhs->meth);
+ #endif
}
#if MICROPY_PY_FUNCTION_ATTRS