Provides a restricted environment for code execution
Defines a class RExec that provides a controlled execution environment
Class attributes:
RExec.nok_builtin_names # List of prohibited built-in functions
RExec.ok_builtin_modules # List of modules that can be imported
RExec.ok_path # List of directories searched on import
RExec.ok_posix_names # List of accepted functions in os module
RExec.ok_sys_names # List of members in sys module
Methods on an instance of RExec
r.r_eval(code) # Evaluate code in restricted mode
r.r_exec(code) # Execute code in restricted mode
r.r_execfile(filename) # Execute file in restricted more
A few methods which may be redefined
r.r_import(modulename) # Called whenever code imports
r.r_open(filename,mode) # Called whenever code opens a file