summaryrefslogtreecommitdiffstatshomepage
path: root/tests/basics/builtin_compile.py
blob: b6f65a2fa319e7aecf78c6123567b5d99abf9e1e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# test compile builtin

try:
    compile
except NameError:
    print("SKIP")
    import sys
    sys.exit()

c = compile("print(x)", "file", "exec")

try:
    exec(c)
except NameError:
    print("NameError")

x = 1
exec(c)

exec(c, {"x":2})
exec(c, {}, {"x":3})