aboutsummaryrefslogtreecommitdiff
path: root/py/objtype.c
diff options
context:
space:
mode:
authorPaul Sokolovsky <pfalcon@users.sourceforge.net>2017-10-27 22:29:15 +0300
committerPaul Sokolovsky <pfalcon@users.sourceforge.net>2017-10-27 22:29:15 +0300
commit0e80f345f88c5db7c2353a5a9d29ed08b0af42f4 (patch)
tree3792408151d40ed71af28fd37dee44cbd67f4ad8 /py/objtype.c
parent9b9dbc58155209e07ab7b9d63d63e5e24db5950c (diff)
py/objtype: Introduce MICROPY_PY_ALL_INPLACE_SPECIAL_METHODS.
This allows to configure support for inplace special methods separately, similar to "normal" and reverse special methods. This is useful, because inplace methods are "the most optional" ones, for example, if inplace methods aren't defined, the operation will be executed using normal methods instead. As a caveat, __iadd__ and __isub__ are implemented even if MICROPY_PY_ALL_INPLACE_SPECIAL_METHODS isn't defined. This is similar to the state of affairs before binary operations refactor, and allows to run existing tests even if MICROPY_PY_ALL_INPLACE_SPECIAL_METHODS isn't defined.
Diffstat (limited to 'py/objtype.c')
-rw-r--r--py/objtype.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/py/objtype.c b/py/objtype.c
index d1c1dcba4..6e2ab6c9a 100644
--- a/py/objtype.c
+++ b/py/objtype.c
@@ -422,11 +422,11 @@ const byte mp_binary_op_method_name[MP_BINARY_OP_NUM_RUNTIME] = {
// MP_BINARY_OP_NOT_EQUAL, // a != b calls a == b and inverts result
[MP_BINARY_OP_IN] = MP_QSTR___contains__,
- #if MICROPY_PY_ALL_SPECIAL_METHODS
// All inplace methods are optional, and normal methods will be used
// as a fallback.
[MP_BINARY_OP_INPLACE_ADD] = MP_QSTR___iadd__,
[MP_BINARY_OP_INPLACE_SUBTRACT] = MP_QSTR___isub__,
+ #if MICROPY_PY_ALL_INPLACE_SPECIAL_METHODS
[MP_BINARY_OP_INPLACE_MULTIPLY] = MP_QSTR___imul__,
[MP_BINARY_OP_INPLACE_FLOOR_DIVIDE] = MP_QSTR___ifloordiv__,
[MP_BINARY_OP_INPLACE_TRUE_DIVIDE] = MP_QSTR___itruediv__,