From de7c425139c92745280b62f7ebb756def96d072a Mon Sep 17 00:00:00 2001
From: Damien George <damien.p.george@gmail.com>
Date: Thu, 17 Apr 2014 19:16:11 +0100
Subject: [PATCH] py: Simplify objfun/objgenerator connection, no need to call
 bc_get.

---
 py/obj.h          | 1 -
 py/objfun.c       | 7 -------
 py/objgenerator.c | 5 +----
 3 files changed, 1 insertion(+), 12 deletions(-)

diff --git a/py/obj.h b/py/obj.h
index 7e1b7e598..a380851e4 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 66145f4a6..07d6606c5 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 9be7fb197..18807e75f 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 = {
-- 
GitLab