diff options
author | Damien George <damien@micropython.org> | 2023-05-12 23:16:37 +1000 |
---|---|---|
committer | Damien George <damien@micropython.org> | 2023-05-19 13:44:00 +1000 |
commit | ea7031faff9efe6803d8a8f67ad2e3b4a6d390e3 (patch) | |
tree | 71faadf644033b57a5e1339102148719ae20a155 /tests/basics/string_mult.py | |
parent | 4b57330465b98df30ef8a10e19a0e197b5797550 (diff) |
py/runtime: If inplace binop fails then try corresponding normal binop.
The code that handles inplace-operator to normal-binary-operator fallback
is moved in this commit from py/objtype.c to py/runtime.c, making it apply
to all types, not just user classes.
Signed-off-by: Damien George <damien@micropython.org>
Diffstat (limited to 'tests/basics/string_mult.py')
-rw-r--r-- | tests/basics/string_mult.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/basics/string_mult.py b/tests/basics/string_mult.py index c0713c1d3..5a7d82294 100644 --- a/tests/basics/string_mult.py +++ b/tests/basics/string_mult.py @@ -10,3 +10,13 @@ for i in (-4, -2, 0, 2, 4): a = '123' c = a * 3 print(a, c) + +# check inplace multiplication +a = '456' +a *= 3 +print(a) + +# check reverse inplace multiplication +a = 3 +a *= '789' +print(a) |