diff options
author | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2014-05-11 03:16:04 +0300 |
---|---|---|
committer | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2014-05-11 03:33:19 +0300 |
commit | ea9708092e8a49377a465ef8c8500943fe9ba772 (patch) | |
tree | 90e5dd9cf1ab38518df12410225b9f4c94066e45 /py/obj.h | |
parent | 9511f60f016547ab00f634d451c230351bd8b225 (diff) | |
download | micropython-ea9708092e8a49377a465ef8c8500943fe9ba772.tar.gz micropython-ea9708092e8a49377a465ef8c8500943fe9ba772.zip |
objtuple: Go out of the way to support comparison of subclasses.
Two things are handled here: allow to compare native subtypes of tuple,
e.g. namedtuple (TODO: should compare type too, currently compared
duck-typedly by content). Secondly, allow user sunclasses of tuples
(and its subtypes) be compared either. "Magic" I did previously in
objtype.c covers only one argument (lhs is many), so we're in trouble
when lhs is native type - there's no other option besides handling
rhs in special manner. Fortunately, this patch outlines approach with
fast path for native types.
Diffstat (limited to 'py/obj.h')
-rw-r--r-- | py/obj.h | 1 |
1 files changed, 1 insertions, 0 deletions
@@ -401,6 +401,7 @@ mp_obj_t mp_obj_new_module(qstr module_name); mp_obj_type_t *mp_obj_get_type(mp_const_obj_t o_in); const char *mp_obj_get_type_str(mp_const_obj_t o_in); bool mp_obj_is_subclass_fast(mp_const_obj_t object, mp_const_obj_t classinfo); // arguments should be type objects +mp_obj_t mp_instance_cast_to_native_base(mp_const_obj_t self_in, mp_const_obj_t native_type); void mp_obj_print_helper(void (*print)(void *env, const char *fmt, ...), void *env, mp_obj_t o_in, mp_print_kind_t kind); void mp_obj_print(mp_obj_t o, mp_print_kind_t kind); |