File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -376,6 +376,12 @@ typedef double mp_float_t;
376376#define MICROPY_PY_BUILTINS_PROPERTY (1)
377377#endif
378378
379+ // Whether to support complete set of special methods
380+ // for user classes, otherwise only the most used
381+ #ifndef MICROPY_PY_ALL_SPECIAL_METHODS
382+ #define MICROPY_PY_ALL_SPECIAL_METHODS (0)
383+ #endif
384+
379385// Whether to support compile function
380386#ifndef MICROPY_PY_BUILTINS_COMPILE
381387#define MICROPY_PY_BUILTINS_COMPILE (0)
Original file line number Diff line number Diff line change @@ -378,9 +378,11 @@ const qstr mp_binary_op_method_name[] = {
378378 MP_BINARY_OP_INPLACE_XOR,
379379 MP_BINARY_OP_INPLACE_AND,
380380 MP_BINARY_OP_INPLACE_LSHIFT,
381- MP_BINARY_OP_INPLACE_RSHIFT,
382- MP_BINARY_OP_INPLACE_ADD,
383- MP_BINARY_OP_INPLACE_SUBTRACT,
381+ MP_BINARY_OP_INPLACE_RSHIFT,*/
382+ #if MICROPY_PY_ALL_SPECIAL_METHODS
383+ [MP_BINARY_OP_INPLACE_ADD ] = MP_QSTR___iadd__ ,
384+ #endif
385+ /*MP_BINARY_OP_INPLACE_SUBTRACT,
384386 MP_BINARY_OP_INPLACE_MULTIPLY,
385387 MP_BINARY_OP_INPLACE_FLOOR_DIVIDE,
386388 MP_BINARY_OP_INPLACE_TRUE_DIVIDE,
Original file line number Diff line number Diff line change @@ -75,6 +75,9 @@ Q(__eq__)
7575Q (__le__ )
7676Q (__ge__ )
7777Q (__reversed__ )
78+ #if MICROPY_PY_ALL_SPECIAL_METHODS
79+ Q (__iadd__ )
80+ #endif
7881
7982Q (micropython )
8083Q (bytecode )
Original file line number Diff line number Diff line change 5959#define MICROPY_PY_BUILTINS_FROZENSET (1)
6060#define MICROPY_PY_BUILTINS_COMPILE (1)
6161#define MICROPY_PY_MICROPYTHON_MEM_INFO (1)
62+ #define MICROPY_PY_ALL_SPECIAL_METHODS (1)
6263#define MICROPY_PY_SYS_EXIT (1)
6364#define MICROPY_PY_SYS_PLATFORM "linux"
6465#define MICROPY_PY_SYS_MAXSIZE (1)
You can’t perform that action at this time.
0 commit comments