diff options
author | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2014-02-27 22:49:47 +0200 |
---|---|---|
committer | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2014-03-03 11:42:53 +0800 |
commit | e74f52b76c2be9aefca689e34cd05f8f64be02f8 (patch) | |
tree | a8e45a23c469ea56390535001f423892ad8d572a /py/objtuple.c | |
parent | d86d22e1e7db19c4b50d92862f8eb0a430d64444 (diff) |
namedtuple: Inherit unary/binary ops from tuple base class.
Diffstat (limited to 'py/objtuple.c')
-rw-r--r-- | py/objtuple.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/py/objtuple.c b/py/objtuple.c index 41ad8a5d5..d39b36d9f 100644 --- a/py/objtuple.c +++ b/py/objtuple.c @@ -86,7 +86,7 @@ STATIC bool tuple_cmp_helper(int op, mp_obj_t self_in, mp_obj_t another_in) { return mp_seq_cmp_objs(op, self->items, self->len, another->items, another->len); } -STATIC mp_obj_t tuple_unary_op(int op, mp_obj_t self_in) { +mp_obj_t tuple_unary_op(int op, mp_obj_t self_in) { mp_obj_tuple_t *self = self_in; switch (op) { case RT_UNARY_OP_BOOL: return MP_BOOL(self->len != 0); @@ -95,7 +95,7 @@ STATIC mp_obj_t tuple_unary_op(int op, mp_obj_t self_in) { } } -STATIC mp_obj_t tuple_binary_op(int op, mp_obj_t lhs, mp_obj_t rhs) { +mp_obj_t tuple_binary_op(int op, mp_obj_t lhs, mp_obj_t rhs) { mp_obj_tuple_t *o = lhs; switch (op) { case RT_BINARY_OP_SUBSCR: @@ -116,7 +116,7 @@ STATIC mp_obj_t tuple_binary_op(int op, mp_obj_t lhs, mp_obj_t rhs) { } case RT_BINARY_OP_ADD: { - if (!MP_OBJ_IS_TYPE(rhs, &tuple_type)) { + if (!mp_obj_is_subclass_fast(mp_obj_get_type(rhs), (mp_obj_t)&tuple_type)) { return NULL; } mp_obj_tuple_t *p = rhs; |