py: Allow multiple of str/list/tuple on left by an integer.
diff --git a/py/objint_mpz.c b/py/objint_mpz.c
index 7f12fbc..27f77d1 100644
--- a/py/objint_mpz.c
+++ b/py/objint_mpz.c
@@ -11,6 +11,7 @@
#include "mpz.h"
#include "objint.h"
#include "runtime0.h"
+#include "runtime.h"
#if MICROPY_LONGINT_IMPL == MICROPY_LONGINT_IMPL_MPZ
@@ -74,7 +75,13 @@
return mp_obj_complex_binary_op(op, mpz_as_float(zlhs), 0, rhs_in);
#endif
} else {
- // unsupported type
+ if (op == MP_BINARY_OP_MULTIPLY) {
+ if (MP_OBJ_IS_STR(rhs_in) || MP_OBJ_IS_TYPE(rhs_in, &mp_type_tuple) || MP_OBJ_IS_TYPE(rhs_in, &mp_type_list)) {
+ // multiply is commutative for these types, so delegate to them
+ return mp_binary_op(op, rhs_in, lhs_in);
+ }
+ }
+ // unsupported operation/type
return MP_OBJ_NULL;
}