summaryrefslogtreecommitdiffstatshomepage
path: root/py
diff options
context:
space:
mode:
authorPaul Sokolovsky <pfalcon@users.sourceforge.net>2016-06-19 00:56:06 +0300
committerPaul Sokolovsky <pfalcon@users.sourceforge.net>2016-06-19 00:56:06 +0300
commitc7fba524cb023be57f4f34c50f116197d198ec0a (patch)
tree57a28e8723bdccd8934050efc7c6ad1bcc3cf2e6 /py
parentefee5773185ded1d8360c9a785d205aec0ce01f0 (diff)
downloadmicropython-c7fba524cb023be57f4f34c50f116197d198ec0a.tar.gz
micropython-c7fba524cb023be57f4f34c50f116197d198ec0a.zip
py/objtype: Inherit protocol vtable from base class only if it exists.
Diffstat (limited to 'py')
-rw-r--r--py/objtype.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/py/objtype.c b/py/objtype.c
index 3020ed513d..907308a757 100644
--- a/py/objtype.c
+++ b/py/objtype.c
@@ -918,7 +918,9 @@ mp_obj_t mp_obj_new_type(qstr name, mp_obj_t bases_tuple, mp_obj_t locals_dict)
// abstract base class which would translate C-level protocol to
// Python method calls, and any subclass inheriting from it will
// support this feature.
- o->protocol = ((mp_obj_type_t*)MP_OBJ_TO_PTR(items[0]))->protocol;
+ if (len > 0) {
+ o->protocol = ((mp_obj_type_t*)MP_OBJ_TO_PTR(items[0]))->protocol;
+ }
o->bases_tuple = MP_OBJ_TO_PTR(bases_tuple);
o->locals_dict = MP_OBJ_TO_PTR(locals_dict);