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 efficient.
This commit is contained in:
parent
9e8f316392
commit
4df013c8cc
1
py/obj.h
1
py/obj.h
|
@ -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);
|
||||
|
|
10
py/objtype.c
10
py/objtype.c
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue