diff --git a/py/obj.h b/py/obj.h
index 7e1b7e598adc1e290c4548ef42373b26c4c930f7..a380851e43d092152f5197c5da23c702ecc34983 100644
--- a/py/obj.h
+++ b/py/obj.h
@@ -496,7 +496,6 @@ typedef struct _mp_obj_fun_native_t { // need this so we can define const object
     // such functions won't be able to access the global scope, but that's probably okay
 } mp_obj_fun_native_t;
 
-void mp_obj_fun_bc_get(mp_obj_t self_in, int *n_args, const byte **code);
 bool mp_obj_fun_prepare_simple_args(mp_obj_t self_in, uint n_args, uint n_kw, const mp_obj_t *args,
                             uint *out_args1_len, const mp_obj_t **out_args1, uint *out_args2_len, const mp_obj_t **out_args2);
 
diff --git a/py/objfun.c b/py/objfun.c
index 66145f4a657fcae9857eae2d8c9925162a7aea8a..07d6606c536c4b94eb83cf683512bc32889fe03c 100644
--- a/py/objfun.c
+++ b/py/objfun.c
@@ -375,13 +375,6 @@ mp_obj_t mp_obj_new_fun_bc(uint scope_flags, qstr *args, uint n_args, mp_obj_t d
     return o;
 }
 
-void mp_obj_fun_bc_get(mp_obj_t self_in, int *n_args, const byte **code) {
-    assert(MP_OBJ_IS_TYPE(self_in, &mp_type_fun_bc));
-    mp_obj_fun_bc_t *self = self_in;
-    *n_args = self->n_args;
-    *code = self->bytecode;
-}
-
 /******************************************************************************/
 /* inline assembler functions                                                 */
 
diff --git a/py/objgenerator.c b/py/objgenerator.c
index 9be7fb197b4721425b7b58885c172d2cf4b4db76..18807e75fbaa7f4fc264d215ea896f2e3a8547eb 100644
--- a/py/objgenerator.c
+++ b/py/objgenerator.c
@@ -26,9 +26,6 @@ STATIC mp_obj_t gen_wrap_call(mp_obj_t self_in, uint n_args, uint n_kw, const mp
     mp_obj_gen_wrap_t *self = self_in;
     mp_obj_fun_bc_t *self_fun = (mp_obj_fun_bc_t*)self->fun;
     assert(MP_OBJ_IS_TYPE(self_fun, &mp_type_fun_bc));
-    int bc_n_args;
-    const byte *bc_code;
-    mp_obj_fun_bc_get(self_fun, &bc_n_args, &bc_code);
 
     const mp_obj_t *args1, *args2;
     uint len1, len2;
@@ -36,7 +33,7 @@ STATIC mp_obj_t gen_wrap_call(mp_obj_t self_in, uint n_args, uint n_kw, const mp
         assert(0);
     }
 
-    return mp_obj_new_gen_instance(self_fun->globals, bc_code, len1, args1, len2, args2);
+    return mp_obj_new_gen_instance(self_fun->globals, self_fun->bytecode, len1, args1, len2, args2);
 }
 
 const mp_obj_type_t mp_type_gen_wrap = {