Compare commits
1 commit
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
837e02328f |
1 changed files with 4 additions and 1 deletions
|
|
@ -55,6 +55,9 @@ def initial_ns():
|
||||||
""", ns)
|
""", ns)
|
||||||
return ns
|
return ns
|
||||||
|
|
||||||
|
compile_flags = (__future__.division.compiler_flag
|
||||||
|
| __future__.print_function.compiler_flag)
|
||||||
|
|
||||||
def getsource(filename):
|
def getsource(filename):
|
||||||
with open(filename, "rU") as f: return f.read()
|
with open(filename, "rU") as f: return f.read()
|
||||||
|
|
||||||
|
|
@ -66,7 +69,7 @@ Returns the resulting top level object"""
|
||||||
oldargv = sys.argv[:]
|
oldargv = sys.argv[:]
|
||||||
try:
|
try:
|
||||||
filename = args[0]
|
filename = args[0]
|
||||||
code = compile(getsource(filename), filename, 'exec')
|
code = compile(getsource(filename), filename, 'exec', compile_flags)
|
||||||
sys.argv[:] = args
|
sys.argv[:] = args
|
||||||
ns = initial_ns()
|
ns = initial_ns()
|
||||||
ns['__file__'] = filename
|
ns['__file__'] = filename
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue