code must either be a string containing a Python expression, or
a compiled code object, which will be evaluated in the restricted
environment's __main__ module. The value of the expression or
code object will be returned.
code must either be a string containing one or more lines of
Python code, or a compiled code object, which will be executed in the
restricted environment's __main__ module.
Execute the Python code contained in the file filename in the
restricted environment's __main__ module.
Methods whose names begin with "s_" are similar to the functions
beginning with "r_", but the code will be granted access to
restricted versions of the standard I/O streams sys.stdin,
sys.stderr, and sys.stdout.
Execute the Python code contained in the file filename in the
restricted environment.
RExec objects must also support various methods which will be
implicitly called by code executing in the restricted environment.
Overriding these methods in a subclass is used to change the policies
enforced by a restricted environment.
Method called when open() is called in the restricted
environment. The arguments are identical to those of open(),
and a file object (or a class instance compatible with file objects)
should be returned. RExec's default behaviour is allow opening
any file for reading, but forbidding any attempt to write a file. See
the example below for an implementation of a less restrictive
r_open().