objtype: Add special unary methods __pos__, __neg__, __invert__.
Conditional on MICROPY_PY_ALL_SPECIAL_METHODS.
This commit is contained in:
@@ -330,9 +330,11 @@ mp_obj_t instance_make_new(mp_obj_t self_in, mp_uint_t n_args, mp_uint_t n_kw, c
|
||||
const qstr mp_unary_op_method_name[] = {
|
||||
[MP_UNARY_OP_BOOL] = MP_QSTR___bool__,
|
||||
[MP_UNARY_OP_LEN] = MP_QSTR___len__,
|
||||
//[MP_UNARY_OP_POSITIVE,
|
||||
//[MP_UNARY_OP_NEGATIVE,
|
||||
//[MP_UNARY_OP_INVERT,
|
||||
#if MICROPY_PY_ALL_SPECIAL_METHODS
|
||||
[MP_UNARY_OP_POSITIVE] = MP_QSTR___pos__,
|
||||
[MP_UNARY_OP_NEGATIVE] = MP_QSTR___neg__,
|
||||
[MP_UNARY_OP_INVERT] = MP_QSTR___invert__,
|
||||
#endif
|
||||
[MP_UNARY_OP_NOT] = MP_QSTR_, // don't need to implement this, used to make sure array has full size
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user