• Jérome Perrin's avatar
    gpython: Don't inherit __future__ when executing scripts · 64088e8a
    Jérome Perrin authored
    Because we use execfile to emulate "python script.py" invocation, future
    enabled in gpython main script are also enabled in "script.py" and because
    we use print_function feature, it was also applied in "script.py".
    On python 2 when "script.py" uses print statements they were considered as
    SyntaxError.
    
    Hopefuly, compile has a `dont_inherit` flag which does exactly what we need
    here: compile the script without inheriting futures enabled, so we use
    compile with this flag.
    
    /reviewed-by @kirr
    /reviewed-on !8
    64088e8a
gpython_test.py 10.6 KB