Commit 98ac2eeb authored by Kevin Modzelewski's avatar Kevin Modzelewski

Merge pull request #324 from tjhance/locals-closure-ordering

fix closure ordering bug for locals()
parents 8b42d921 973f480b
......@@ -645,11 +645,14 @@ BoxedDict* getLocals(bool only_user_visible, bool includeClosure) {
Box* val = closure->attrs.attr_list->attrs[offset];
ScopeInfo* scope_info = cf->clfunc->source->getScopeInfo();
if (val != NULL && scope_info->refersToClosure(scope_info->internString(name))) {
Box* boxedName = boxString(name);
if (d->d.count(boxedName) == 0) {
d->d[boxString(name)] = val;
}
}
}
}
}
return d;
}
......
......@@ -40,3 +40,19 @@ def f4(t):
print sorted(locals().items())
f4(0)
f4(1)
def f5():
a = 0
b = 1
def g():
print a
def h():
a = 2
def i():
print a
print b
print sorted(locals().items())
i()
h()
g()
f5()
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment