Skip to content

Don't inherit __future__ when executing scripts

Jérome Perrin requested to merge jerome/pygolang:fix/execfile_futures into master

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.

Edited by Jérome Perrin

Merge request reports