aboutsummaryrefslogtreecommitdiff
path: root/py/emitcommon.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2018-10-26 16:48:07 +1100
committerDamien George <damien.p.george@gmail.com>2018-10-28 00:33:08 +1100
commit9201f46cc8e92231f0f6c92e4d56befbc150f72c (patch)
tree425eeb6f9031a94acf2b79cb56a0a35a902da173 /py/emitcommon.c
parentc2074e7b66a042492604fbf9ea80b71cdf848e93 (diff)
py/compile: Fix case of eager implicit conversion of local to nonlocal.
This ensures that implicit variables are only converted to implicit closed-over variables (nonlocals) at the very end of the function scope. If variables are closed-over when first used (read from, as was done prior to this commit) then this can be incorrect because the variable may be assigned to later on in the function which means they are just a plain local, not closed over. Fixes issue #4272.
Diffstat (limited to 'py/emitcommon.c')
-rw-r--r--py/emitcommon.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/py/emitcommon.c b/py/emitcommon.c
index 89cc2c959..149e0b0f1 100644
--- a/py/emitcommon.c
+++ b/py/emitcommon.c
@@ -35,7 +35,7 @@ void mp_emit_common_get_id_for_load(scope_t *scope, qstr qst) {
bool added;
id_info_t *id = scope_find_or_add_id(scope, qst, &added);
if (added) {
- scope_find_local_and_close_over(scope, id, qst);
+ id->kind = ID_INFO_KIND_GLOBAL_IMPLICIT;
}
}