Skip to content

Commit de7c425

Browse files
committed
py: Simplify objfun/objgenerator connection, no need to call bc_get.
1 parent d89b69e commit de7c425

3 files changed

Lines changed: 1 addition & 12 deletions

File tree

py/obj.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,6 @@ typedef struct _mp_obj_fun_native_t { // need this so we can define const object
496496
// such functions won't be able to access the global scope, but that's probably okay
497497
} mp_obj_fun_native_t;
498498

499-
void mp_obj_fun_bc_get(mp_obj_t self_in, int *n_args, const byte **code);
500499
bool mp_obj_fun_prepare_simple_args(mp_obj_t self_in, uint n_args, uint n_kw, const mp_obj_t *args,
501500
uint *out_args1_len, const mp_obj_t **out_args1, uint *out_args2_len, const mp_obj_t **out_args2);
502501

py/objfun.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -375,13 +375,6 @@ mp_obj_t mp_obj_new_fun_bc(uint scope_flags, qstr *args, uint n_args, mp_obj_t d
375375
return o;
376376
}
377377

378-
void mp_obj_fun_bc_get(mp_obj_t self_in, int *n_args, const byte **code) {
379-
assert(MP_OBJ_IS_TYPE(self_in, &mp_type_fun_bc));
380-
mp_obj_fun_bc_t *self = self_in;
381-
*n_args = self->n_args;
382-
*code = self->bytecode;
383-
}
384-
385378
/******************************************************************************/
386379
/* inline assembler functions */
387380

py/objgenerator.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,14 @@ STATIC mp_obj_t gen_wrap_call(mp_obj_t self_in, uint n_args, uint n_kw, const mp
2626
mp_obj_gen_wrap_t *self = self_in;
2727
mp_obj_fun_bc_t *self_fun = (mp_obj_fun_bc_t*)self->fun;
2828
assert(MP_OBJ_IS_TYPE(self_fun, &mp_type_fun_bc));
29-
int bc_n_args;
30-
const byte *bc_code;
31-
mp_obj_fun_bc_get(self_fun, &bc_n_args, &bc_code);
3229

3330
const mp_obj_t *args1, *args2;
3431
uint len1, len2;
3532
if (!mp_obj_fun_prepare_simple_args(self_fun, n_args, n_kw, args, &len1, &args1, &len2, &args2)) {
3633
assert(0);
3734
}
3835

39-
return mp_obj_new_gen_instance(self_fun->globals, bc_code, len1, args1, len2, args2);
36+
return mp_obj_new_gen_instance(self_fun->globals, self_fun->bytecode, len1, args1, len2, args2);
4037
}
4138

4239
const mp_obj_type_t mp_type_gen_wrap = {

0 commit comments

Comments
 (0)