py/obj: Add support for __float__ and __complex__ functions.

This commit is contained in:
Andrew Leech
2022-07-04 17:35:46 +10:00
committed by Damien George
parent fa15aed0f7
commit 1e87b56219
9 changed files with 130 additions and 3 deletions

View File

@@ -378,6 +378,12 @@ const byte mp_unary_op_method_name[MP_UNARY_OP_NUM_RUNTIME] = {
[MP_UNARY_OP_INVERT] = MP_QSTR___invert__,
[MP_UNARY_OP_ABS] = MP_QSTR___abs__,
#endif
#if MICROPY_PY_BUILTINS_FLOAT
[MP_UNARY_OP_FLOAT_MAYBE] = MP_QSTR___float__,
#if MICROPY_PY_BUILTINS_COMPLEX
[MP_UNARY_OP_COMPLEX_MAYBE] = MP_QSTR___complex__,
#endif
#endif
#if MICROPY_PY_SYS_GETSIZEOF
[MP_UNARY_OP_SIZEOF] = MP_QSTR___sizeof__,
#endif