circuitpython/tests/micropython/viper_storeattr.py
Jim Mussared 9714a0ead5 py/emitnative: Fix STORE_ATTR viper code-gen when value is not a pyobj.
There was a missing call to MP_F_CONVERT_NATIVE_TO_OBJ.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-07-12 17:18:27 +10:00

26 lines
268 B
Python

# test storing an attribute with a value of different viper types
class X:
def __str__(self):
return "X"
x = X()
@micropython.viper
def a():
x.i0 = 0
x.i7 = 7
x.s = "hello"
x.o = x
a()
print(x.i0)
print(x.i7)
print(x.s)
print(x.o)