diff options
| author | Jeff Epler <jepler@unpythonic.net> | 2018-03-25 16:13:49 -0500 |
|---|---|---|
| committer | Jeff Epler <jepler@gmail.com> | 2018-03-29 06:42:10 -0500 |
| commit | ff06a455995322978dbd9ad9291154ebbdf0abb5 (patch) | |
| tree | 10151a20c72514253de9d7cb3027a73ec0440ed6 /py | |
| parent | 6da8d7c46583387aa32d5c153b3c5b7d9e1afccd (diff) | |
Fix assertion failures in super_attr
micropython: ../../py/objtype.c:1100: super_attr: Assertion `MP_OBJ_IS_TYPE(self->type, &mp_type_type)' failed.
e.g., when making calls like
super(1, 1).x
Diffstat (limited to 'py')
| -rw-r--r-- | py/objtype.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/py/objtype.c b/py/objtype.c index 3fa25eb77..5b70e8e48 100644 --- a/py/objtype.c +++ b/py/objtype.c @@ -1085,6 +1085,9 @@ STATIC mp_obj_t super_make_new(const mp_obj_type_t *type_in, size_t n_args, size // 0 arguments are turned into 2 in the compiler // 1 argument is not yet implemented mp_arg_check_num(n_args, n_kw, 2, 2, false); + if(!MP_OBJ_IS_TYPE(args[0], &mp_type_type)) { + mp_raise_TypeError("first argument to super() must be type"); + } mp_obj_super_t *o = m_new_obj(mp_obj_super_t); *o = (mp_obj_super_t){{type_in}, args[0], args[1]}; return MP_OBJ_FROM_PTR(o); |
