summaryrefslogtreecommitdiff
path: root/py/objint_mpz.c
diff options
context:
space:
mode:
authorDamien George <damien@micropython.org>2023-01-23 12:24:39 +1100
committerDamien George <damien@micropython.org>2023-01-23 13:03:51 +1100
commitd387ae3444751a3ba1032bd16243cb2dc741e333 (patch)
tree73a885555bb9433bcb2b3810540e544d21808950 /py/objint_mpz.c
parentd4a4cde42e80dc2c25c018af200e641b03999e19 (diff)
py/objint_mpz: Catch and reject @ and @= operating on big integers.
This will also catch / and /= when float support is disabled. Fixes issue #10544. Signed-off-by: Damien George <damien@micropython.org>
Diffstat (limited to 'py/objint_mpz.c')
-rw-r--r--py/objint_mpz.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/py/objint_mpz.c b/py/objint_mpz.c
index 2811bcf2a..e9545149f 100644
--- a/py/objint_mpz.c
+++ b/py/objint_mpz.c
@@ -296,8 +296,7 @@ mp_obj_t mp_obj_int_binary_op(mp_binary_op_t op, mp_obj_t lhs_in, mp_obj_t rhs_i
mpz_pow_inpl(&res->mpz, zlhs, zrhs);
break;
- default: {
- assert(op == MP_BINARY_OP_DIVMOD);
+ case MP_BINARY_OP_DIVMOD: {
if (mpz_is_zero(zrhs)) {
goto zero_division_error;
}
@@ -306,6 +305,9 @@ mp_obj_t mp_obj_int_binary_op(mp_binary_op_t op, mp_obj_t lhs_in, mp_obj_t rhs_i
mp_obj_t tuple[2] = {MP_OBJ_FROM_PTR(quo), MP_OBJ_FROM_PTR(res)};
return mp_obj_new_tuple(2, tuple);
}
+
+ default:
+ return MP_OBJ_NULL; // op not supported
}
return MP_OBJ_FROM_PTR(res);