diff --git a/py/objtype.c b/py/objtype.c index 6accaa74ed..711572bd4b 100644 --- a/py/objtype.c +++ b/py/objtype.c @@ -368,10 +368,12 @@ const qstr mp_binary_op_method_name[] = { */ [MP_BINARY_OP_ADD] = MP_QSTR___add__, [MP_BINARY_OP_SUBTRACT] = MP_QSTR___sub__, + #if MICROPY_PY_ALL_SPECIAL_METHODS + [MP_BINARY_OP_MULTIPLY] = MP_QSTR___mul__, + [MP_BINARY_OP_FLOOR_DIVIDE] = MP_QSTR___floordiv__, + [MP_BINARY_OP_TRUE_DIVIDE] = MP_QSTR___truediv__, + #endif /* - MP_BINARY_OP_MULTIPLY, - MP_BINARY_OP_FLOOR_DIVIDE, - MP_BINARY_OP_TRUE_DIVIDE, MP_BINARY_OP_MODULO, MP_BINARY_OP_POWER, MP_BINARY_OP_INPLACE_OR, @@ -381,9 +383,9 @@ const qstr mp_binary_op_method_name[] = { MP_BINARY_OP_INPLACE_RSHIFT,*/ #if MICROPY_PY_ALL_SPECIAL_METHODS [MP_BINARY_OP_INPLACE_ADD] = MP_QSTR___iadd__, + [MP_BINARY_OP_INPLACE_SUBTRACT] = MP_QSTR___isub__, #endif - /*MP_BINARY_OP_INPLACE_SUBTRACT, - MP_BINARY_OP_INPLACE_MULTIPLY, + /*MP_BINARY_OP_INPLACE_MULTIPLY, MP_BINARY_OP_INPLACE_FLOOR_DIVIDE, MP_BINARY_OP_INPLACE_TRUE_DIVIDE, MP_BINARY_OP_INPLACE_MODULO, diff --git a/py/qstrdefs.h b/py/qstrdefs.h index 32f5b2ce05..f273367d54 100644 --- a/py/qstrdefs.h +++ b/py/qstrdefs.h @@ -76,7 +76,11 @@ Q(__le__) Q(__ge__) Q(__reversed__) #if MICROPY_PY_ALL_SPECIAL_METHODS +Q(__mul__) +Q(__truediv__) +Q(__floordiv__) Q(__iadd__) +Q(__isub__) #endif Q(micropython)