Commit b77a9155 authored by Kevin Modzelewski's avatar Kevin Modzelewski

Test cases

parent db67a4ab
......@@ -1023,8 +1023,11 @@ $(call make_target,_gcc)
nosearch_runpy_% nosearch_pyrun_%: %.py ext_python
$(VERB) PYTHONPATH=test/test_extension/build/lib.linux-x86_64-2.7 zsh -c 'time python $<'
nosearch_pypyrun_%: %.py ext_python
$(VERB) PYTHONPATH=test/test_extension/build/lib.linux-x86_64-2.7 zsh -c 'time python $<'
$(call make_search,runpy_%)
$(call make_search,pyrun_%)
$(call make_search,pypyrun_%)
nosearch_check_%: %.py ext_python ext_pyston
$(MAKE) check_dbg ARGS="$(patsubst %.py,%,$(notdir $<)) -K"
......
c = compile("a = 1; print a", "test.py", "exec")
print type(c)
print
a = 0
exec c
print a
print
a = 0
g = {}
exec c in g
print a, sorted(g.keys())
print
g = {}
exec """
c = compile("a = 1; print a", "test.py", "exec")
""" in g
a = 0
exec g['c']
print a, sorted(g.keys())
print
a = 0
g = {'_c':c}
exec "exec _c" in g
print a, sorted(g.keys())
from __future__ import division
# compile() inherits the future flags of the parent module
print 1 / 2
exec "print 1 / 2"
exec compile("print 1 / 2", "<string>", "exec")
# But you can explicitly request that they not be inherited:
exec compile("print 1 / 2", "<string>", "exec", flags=0, dont_inherit=True)
# expected: fail
# - not currently supported
def f():
global b
b = 1
print b
print
b = 0
g = {}
exec f.func_code in g
print b, sorted(g.keys())
print
b = 0
g = {'f':f}
exec "f()" in g
print b, sorted(g.keys())
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