aboutsummaryrefslogtreecommitdiff
path: root/py/objtype.c
diff options
context:
space:
mode:
authorJeff Epler <jepler@unpythonic.net>2018-03-25 16:13:49 -0500
committerDamien George <damien.p.george@gmail.com>2018-05-30 11:14:07 +1000
commitc60589c02b998794837489a6c6e51c4723af097f (patch)
tree574f1ef797e9a9a3acb13d0259531e60664f6c04 /py/objtype.c
parent05b13fd292b42f20affc7cae218d92447efbf6d6 (diff)
py/objtype: Fix assertion failures in super_attr by checking type.
Fixes assertion failures and segmentation faults when making calls like: super(1, 1).x
Diffstat (limited to 'py/objtype.c')
-rw-r--r--py/objtype.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/py/objtype.c b/py/objtype.c
index 9b57a5051..77810ce70 100644
--- a/py/objtype.c
+++ b/py/objtype.c
@@ -1112,6 +1112,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(NULL);
+ }
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);