From 48ffd6596e7a4c185a81be233b46d3c99a83a7ac Mon Sep 17 00:00:00 2001 From: Damien George Date: Thu, 25 May 2023 10:57:08 +1000 Subject: py: Change MP_UNARY_OP_INT to MP_UNARY_OP_INT_MAYBE. To be consistent with MP_UNARY_OP_INT_FLOAT and MP_UNARY_OP_INT_COMPLEX, and allow int() to first check if a type supports __int__ before trying other things (as per CPython). Signed-off-by: Damien George --- py/objint_mpz.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'py/objint_mpz.c') diff --git a/py/objint_mpz.c b/py/objint_mpz.c index e9545149f..8078441d6 100644 --- a/py/objint_mpz.c +++ b/py/objint_mpz.c @@ -165,6 +165,8 @@ mp_obj_t mp_obj_int_unary_op(mp_unary_op_t op, mp_obj_t o_in) { mpz_abs_inpl(&self2->mpz, &self->mpz); return MP_OBJ_FROM_PTR(self2); } + case MP_UNARY_OP_INT_MAYBE: + return o_in; default: return MP_OBJ_NULL; // op not supported } -- cgit v1.2.3