summaryrefslogtreecommitdiff
path: root/py
diff options
context:
space:
mode:
authorDamien George <damien@micropython.org>2022-03-25 12:35:49 +1100
committerDamien George <damien@micropython.org>2022-03-25 12:35:49 +1100
commit9e3e67b1d8bf0fd5ee612b3c828ae549f76d1407 (patch)
treef1047dca175f2170be58a87e619034ffd1a4e50d /py
parent768879f999f4739e8507ae6013b5e9271618656e (diff)
py/objgenerator: Fix unused variables when native gen extracts prelude.
Some compilers will warn about unused variables like scope_flags. So use MP_BC_PRELUDE_SIG_DECODE() which will silence these warnings. Signed-off-by: Damien George <damien@micropython.org>
Diffstat (limited to 'py')
-rw-r--r--py/objgenerator.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/py/objgenerator.c b/py/objgenerator.c
index cbe79e66a..850de3fb6 100644
--- a/py/objgenerator.c
+++ b/py/objgenerator.c
@@ -103,13 +103,10 @@ STATIC mp_obj_t native_gen_wrap_call(mp_obj_t self_in, size_t n_args, size_t n_k
// Extract n_state from the prelude.
const uint8_t *ip = prelude_ptr;
- size_t n_state, n_exc_stack_unused, scope_flags, n_pos_args, n_kwonly_args, n_def_args;
- MP_BC_PRELUDE_SIG_DECODE_INTO(ip, n_state, n_exc_stack_unused, scope_flags, n_pos_args, n_kwonly_args, n_def_args);
- size_t n_exc_stack = 0;
+ MP_BC_PRELUDE_SIG_DECODE(ip);
- // Allocate the generator object, with room for local stack and exception stack
- mp_obj_gen_instance_t *o = m_new_obj_var(mp_obj_gen_instance_t, byte,
- n_state * sizeof(mp_obj_t) + n_exc_stack * sizeof(mp_exc_stack_t));
+ // Allocate the generator object, with room for local stack (exception stack not needed).
+ mp_obj_gen_instance_t *o = m_new_obj_var(mp_obj_gen_instance_t, byte, n_state * sizeof(mp_obj_t));
o->base.type = &mp_type_gen_instance;
// Parse the input arguments and set up the code state