summaryrefslogtreecommitdiff
path: root/py/objfun.c
diff options
context:
space:
mode:
authorDamien George <damien@micropython.org>2022-06-25 00:05:39 +1000
committerDamien George <damien@micropython.org>2022-06-25 00:22:15 +1000
commite22b7fb4afbf62a9ca3162539c2d0236aefd8945 (patch)
tree8bbf856f1dd860fb151bc5c0f331b08b7fcbd169 /py/objfun.c
parent268ec1e3eb818c92f2ad0015902afef4c4c59ba5 (diff)
py/objfun: Support function attributes on native functions.
Native functions can just reuse the bytecode function attribute code. Signed-off-by: Damien George <damien@micropython.org>
Diffstat (limited to 'py/objfun.c')
-rw-r--r--py/objfun.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/py/objfun.c b/py/objfun.c
index 8f0c3eb6d..37c1eaa54 100644
--- a/py/objfun.c
+++ b/py/objfun.c
@@ -421,8 +421,14 @@ STATIC const mp_obj_type_t mp_type_fun_native = {
{ &mp_type_type },
.flags = MP_TYPE_FLAG_BINDS_SELF,
.name = MP_QSTR_function,
+ #if MICROPY_CPYTHON_COMPAT
+ .print = fun_bc_print,
+ #endif
.call = fun_native_call,
.unary_op = mp_generic_unary_op,
+ #if MICROPY_PY_FUNCTION_ATTRS
+ .attr = mp_obj_fun_bc_attr,
+ #endif
};
mp_obj_t mp_obj_new_fun_native(const mp_obj_t *def_args, const void *fun_data, const mp_module_context_t *mc, struct _mp_raw_code_t *const *child_table) {