Merge pull request #1332 from RustPython/load_global_loading_local

load_global shouldn't load outermost locals.
This commit is contained in:
Adam 2019-09-02 10:13:19 +01:00 committed by GitHub
commit 4ae902f788

View file

@ -251,8 +251,11 @@ impl SymbolTableAnalyzer {
if found_in_outer_scope {
// Symbol is in some outer scope.
symbol.is_free = true;
} else if self.tables.is_empty() {
// Don't make assumptions when we don't know.
symbol.scope = SymbolScope::Unknown;
} else {
// Well, it must be a global then :)
// If there are scopes above we can assume global.
symbol.scope = SymbolScope::Global;
}
}