mirror of
https://github.com/micropython/micropython.git
synced 2026-01-07 20:50:14 +01:00
py: Define and use MP_OBJ_ITER_BUF_NSLOTS to get size of stack iter buf.
It improves readability of code and reduces the chance to make a mistake. This patch also fixes a bug with nan-boxing builds by rounding up the calculation of the new NSLOTS variable, giving the correct number of slots (being 4) even if mp_obj_t is larger than the native machine size.
This commit is contained in:
@@ -3005,6 +3005,7 @@ STATIC void compile_scope(compiler_t *comp, scope_t *scope, pass_kind_t pass) {
|
||||
// There are 4 slots on the stack for the iterator, and the first one is
|
||||
// NULL to indicate that the second one points to the iterator object.
|
||||
if (scope->kind == SCOPE_GEN_EXPR) {
|
||||
// TODO static assert that MP_OBJ_ITER_BUF_NSLOTS == 4
|
||||
EMIT(load_null);
|
||||
compile_load_id(comp, qstr_arg);
|
||||
EMIT(load_null);
|
||||
|
||||
Reference in New Issue
Block a user