Open loechel opened 6 years ago
supersede #96
Currently
_compile_restricted_mode
takesflags
anddont_inherit
as arguments but it does not pass them tocompile
(code has comment signs in front of) in case there is a policy.Either it should not have arguments or it should handle them properly.
by @icemac
is it related to this code:
Why were these lines commented?
@ebagdasa as fas as I remember they are commented out, as we got problems / unpredicted results if we pass the current defaults.
We should look more into that when we have time.
For reference, to get __future__.print_function
working, I did https://github.com/perrinjerome/RestrictedPython/commit/4c132f622f33575aca8da1d0450caa3a33b8c0a0 . The missing piece of the puzzle seems to be that the ast should not be retrieved with ast.parse
but with compile
and ast.PyCF_ONLY_AST
flags - at least for print_function because this is a future that makes a difference at parsing time, not compile time.
@stephan-hof did bring up the point that the current handling of
flags
anddont_inherit
did not work as expected in https://github.com/zopefoundation/RestrictedPython/pull/39#issuecomment-283074699