Commit 4df013c8 authored by Damien George's avatar Damien George
Browse files

py/objtype: mp_obj_new_super doesn't need to be public, so inline it.

Saves code size (20 bytes on bare-arm) and makes it a tiny bit more
parent 9e8f3163
......@@ -661,7 +661,6 @@ mp_obj_t mp_obj_new_list(size_t n, mp_obj_t *items);
mp_obj_t mp_obj_new_dict(size_t n_args);
mp_obj_t mp_obj_new_set(size_t n_args, mp_obj_t *items);
mp_obj_t mp_obj_new_slice(mp_obj_t start, mp_obj_t stop, mp_obj_t step);
mp_obj_t mp_obj_new_super(mp_obj_t type, mp_obj_t obj);
mp_obj_t mp_obj_new_bound_meth(mp_obj_t meth, mp_obj_t self);
mp_obj_t mp_obj_new_getitem_iter(mp_obj_t *args, mp_obj_iter_buf_t *iter_buf);
mp_obj_t mp_obj_new_module(qstr module_name);
......@@ -1013,7 +1013,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);
return mp_obj_new_super(args[0], args[1]);
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);
STATIC void super_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest) {
......@@ -1068,12 +1070,6 @@ const mp_obj_type_t mp_type_super = {
.attr = super_attr,
mp_obj_t mp_obj_new_super(mp_obj_t type, mp_obj_t obj) {
mp_obj_super_t *o = m_new_obj(mp_obj_super_t);
*o = (mp_obj_super_t){{&mp_type_super}, type, obj};
return MP_OBJ_FROM_PTR(o);
// subclassing and built-ins specific to types
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment