-
-
Notifications
You must be signed in to change notification settings - Fork 32.9k
Closed
Labels
interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
As already mentioned in #100185 builtin function compile
does not take into account their enclosing scope. For instance:
x = 0
def a():
print(x)
x = 1
def b():
source = "print(x)"
co = compile(source, "", "exec")
exec(co, globals(), locals())
x = 1
Invocation of the first function works correctly and generates an exception, what can not be said about the second one. This example and one in issue above are also relevant for all currently supported python versions. I bet this can be fixed by promoting the symbol table of the scope to the function.
Eclips4
Metadata
Metadata
Assignees
Labels
interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error