diff options
Diffstat (limited to 'Doc/lib/librexec.tex')
-rw-r--r-- | Doc/lib/librexec.tex | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/Doc/lib/librexec.tex b/Doc/lib/librexec.tex index 3e54102..3104004 100644 --- a/Doc/lib/librexec.tex +++ b/Doc/lib/librexec.tex @@ -89,20 +89,20 @@ makes use of this and would break were it not available. \class{RExec} instances support the following methods: -\begin{methoddesc}{r_eval}{code} +\begin{methoddesc}[RExec]{r_eval}{code} \var{code} must either be a string containing a Python expression, or a compiled code object, which will be evaluated in the restricted environment's \module{__main__} module. The value of the expression or code object will be returned. \end{methoddesc} -\begin{methoddesc}{r_exec}{code} +\begin{methoddesc}[RExec]{r_exec}{code} \var{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 \module{__main__} module. \end{methoddesc} -\begin{methoddesc}{r_execfile}{filename} +\begin{methoddesc}[RExec]{r_execfile}{filename} Execute the Python code contained in the file \var{filename} in the restricted environment's \module{__main__} module. \end{methoddesc} @@ -112,17 +112,17 @@ beginning with \samp{r_}, but the code will be granted access to restricted versions of the standard I/O streams \code{sys.stdin}, \code{sys.stderr}, and \code{sys.stdout}. -\begin{methoddesc}{s_eval}{code} +\begin{methoddesc}[RExec]{s_eval}{code} \var{code} must be a string containing a Python expression, which will be evaluated in the restricted environment. \end{methoddesc} -\begin{methoddesc}{s_exec}{code} +\begin{methoddesc}[RExec]{s_exec}{code} \var{code} must be a string containing one or more lines of Python code, which will be executed in the restricted environment. \end{methoddesc} -\begin{methoddesc}{s_execfile}{code} +\begin{methoddesc}[RExec]{s_execfile}{code} Execute the Python code contained in the file \var{filename} in the restricted environment. \end{methoddesc} @@ -132,13 +132,13 @@ 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. -\begin{methoddesc}{r_import}{modulename\optional{, globals\optional{, - locals\optional{, fromlist}}}} +\begin{methoddesc}[RExec]{r_import}{modulename\optional{, globals\optional{, + locals\optional{, fromlist}}}} Import the module \var{modulename}, raising an \exception{ImportError} exception if the module is considered unsafe. \end{methoddesc} -\begin{methoddesc}{r_open}{filename\optional{, mode\optional{, bufsize}}} +\begin{methoddesc}[RExec]{r_open}{filename\optional{, mode\optional{, bufsize}}} Method called when \function{open()} is called in the restricted environment. The arguments are identical to those of \function{open()}, and a file object (or a class instance compatible with file objects) @@ -148,28 +148,28 @@ the example below for an implementation of a less restrictive \method{r_open()}. \end{methoddesc} -\begin{methoddesc}{r_reload}{module} +\begin{methoddesc}[RExec]{r_reload}{module} Reload the module object \var{module}, re-parsing and re-initializing it. \end{methoddesc} -\begin{methoddesc}{r_unload}{module} +\begin{methoddesc}[RExec]{r_unload}{module} Unload the module object \var{module} (remove it from the restricted environment's \code{sys.modules} dictionary). \end{methoddesc} And their equivalents with access to restricted standard I/O streams: -\begin{methoddesc}{s_import}{modulename\optional{, globals\optional{, - locals\optional{, fromlist}}}} +\begin{methoddesc}[RExec]{s_import}{modulename\optional{, globals\optional{, + locals\optional{, fromlist}}}} Import the module \var{modulename}, raising an \exception{ImportError} exception if the module is considered unsafe. \end{methoddesc} -\begin{methoddesc}{s_reload}{module} +\begin{methoddesc}[RExec]{s_reload}{module} Reload the module object \var{module}, re-parsing and re-initializing it. \end{methoddesc} -\begin{methoddesc}{s_unload}{module} +\begin{methoddesc}[RExec]{s_unload}{module} Unload the module object \var{module}. % XXX what are the semantics of this? \end{methoddesc} @@ -184,7 +184,7 @@ instance won't have any effect; instead, create a subclass of Instances of the new class will then use those new values. All these attributes are tuples of strings. -\begin{memberdesc}{nok_builtin_names} +\begin{memberdesc}[RExec]{nok_builtin_names} Contains the names of built-in functions which will \emph{not} be available to programs running in the restricted environment. The value for \class{RExec} is \code{('open', 'reload', '__import__')}. @@ -196,7 +196,7 @@ built-in functions are added to Python, they will also be added to this module.) \end{memberdesc} -\begin{memberdesc}{ok_builtin_modules} +\begin{memberdesc}[RExec]{ok_builtin_modules} Contains the names of built-in modules which can be safely imported. The value for \class{RExec} is \code{('audioop', 'array', 'binascii', 'cmath', 'errno', 'imageop', 'marshal', 'math', 'md5', 'operator', @@ -205,14 +205,14 @@ The value for \class{RExec} is \code{('audioop', 'array', 'binascii', applies --- use the value from the base class as a starting point. \end{memberdesc} -\begin{memberdesc}{ok_path} +\begin{memberdesc}[RExec]{ok_path} Contains the directories which will be searched when an \keyword{import} is performed in the restricted environment. The value for \class{RExec} is the same as \code{sys.path} (at the time the module is loaded) for unrestricted code. \end{memberdesc} -\begin{memberdesc}{ok_posix_names} +\begin{memberdesc}[RExec]{ok_posix_names} % Should this be called ok_os_names? Contains the names of the functions in the \refmodule{os} module which will be available to programs running in the restricted environment. The @@ -221,14 +221,14 @@ value for \class{RExec} is \code{('error', 'fstat', 'listdir', 'getcwd', 'getuid', 'getgid', 'geteuid', 'getegid')}. \end{memberdesc} -\begin{memberdesc}{ok_sys_names} +\begin{memberdesc}[RExec]{ok_sys_names} Contains the names of the functions and variables in the \refmodule{sys} module which will be available to programs running in the restricted environment. The value for \class{RExec} is \code{('ps1', 'ps2', 'copyright', 'version', 'platform', 'exit', 'maxint')}. \end{memberdesc} -\begin{memberdesc}{ok_file_types} +\begin{memberdesc}[RExec]{ok_file_types} Contains the file types from which modules are allowed to be loaded. Each file type is an integer constant defined in the \refmodule{imp} module. The meaningful values are \constant{PY_SOURCE}, \constant{PY_COMPILED}, and |