summaryrefslogtreecommitdiffstatshomepage
path: root/py
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2017-04-22 12:14:04 +1000
committerDamien George <damien.p.george@gmail.com>2017-04-22 12:14:04 +1000
commit4df013c8ccf2e122a1bd3dd75d3937d46019409a (patch)
treec82fe66833b8c9b3b908bdad2d25f2eb89a8bf0e /py
parent9e8f3163924c1f429f16f44a4a27b0cd33064719 (diff)
downloadmicropython-4df013c8ccf2e122a1bd3dd75d3937d46019409a.tar.gz
micropython-4df013c8ccf2e122a1bd3dd75d3937d46019409a.zip
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.
Diffstat (limited to 'py')
-rw-r--r--py/obj.h1
-rw-r--r--py/objtype.c10
2 files changed, 3 insertions, 8 deletions
diff --git a/py/obj.h b/py/obj.h
index b5a0c41906..a3c06a261a 100644
--- a/py/obj.h
+++ b/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);
diff --git a/py/objtype.c b/py/objtype.c
index 5e522bed23..de1ee8c421 100644
--- a/py/objtype.c
+++ b/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