diff options
author | Guido van Rossum <guido@python.org> | 2003-03-01 03:20:41 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2003-03-01 03:20:41 (GMT) |
commit | 46d3dc37e4a01e8d72b00ab9ad4e4a07022b7b64 (patch) | |
tree | d2c8e67f458cd38115f6865be8034150d9e7242c /Doc | |
parent | d1a283be269c66eb813948febc3ce6c9405fb64f (diff) | |
download | cpython-46d3dc37e4a01e8d72b00ab9ad4e4a07022b7b64.zip cpython-46d3dc37e4a01e8d72b00ab9ad4e4a07022b7b64.tar.gz cpython-46d3dc37e4a01e8d72b00ab9ad4e4a07022b7b64.tar.bz2 |
- New function sys.exc_clear() clears the current exception. This is
rarely needed, but can sometimes be useful to release objects
referenced by the traceback held in sys.exc_info()[2]. (SF patch
#693195.) Thanks to Kevin Jacobs!
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/lib/libsys.tex | 20 | ||||
-rw-r--r-- | Doc/tut/tut.tex | 17 |
2 files changed, 29 insertions, 8 deletions
diff --git a/Doc/lib/libsys.tex b/Doc/lib/libsys.tex index 3f8f7b6..d027aa6 100644 --- a/Doc/lib/libsys.tex +++ b/Doc/lib/libsys.tex @@ -99,6 +99,11 @@ It is always available. encapsulates the call stack at the point where the exception originally occurred. \obindex{traceback} + If \function{exc_clear()} is called, this function will return three + \code{None} values until either another exception is raised in the + current thread or the execution stack returns to a frame where + another exception is being handled. + \warning{Assigning the \var{traceback} return value to a local variable in a function that is handling an exception will cause a circular reference. This will prevent anything referenced @@ -115,6 +120,21 @@ It is always available. efficient to avoid creating cycles.} \end{funcdesc} +\begin{funcdesc}{exc_clear}{} + This function clears all information relating to the current or last + exception that occured in the current thread. After calling this + function, \function{exc_info()} will return three \code{None} values until + another exception is raised in the current thread or the execution stack + returns to a frame where another exception is being handled. + + This function is only needed in only a few obscure situations. These + include logging and error handling systems that report information on the + last or current exception. This function can also be used to try to free + resources and trigger object finalization, though no guarantee is made as + to what objects will be freed, if any. +\versionadded{2.3} +\end{funcdesc} + \begin{datadesc}{exc_type} \dataline{exc_value} \dataline{exc_traceback} diff --git a/Doc/tut/tut.tex b/Doc/tut/tut.tex index cfc56f0..a9fb325 100644 --- a/Doc/tut/tut.tex +++ b/Doc/tut/tut.tex @@ -2451,14 +2451,15 @@ a module defines. It returns a sorted list of strings: ['__name__', 'fib', 'fib2'] >>> dir(sys) ['__displayhook__', '__doc__', '__excepthook__', '__name__', '__stderr__', - '__stdin__', '__stdout__', '_getframe', 'argv', 'builtin_module_names', - 'byteorder', 'copyright', 'displayhook', 'exc_info', 'exc_type', - 'excepthook', 'exec_prefix', 'executable', 'exit', 'getdefaultencoding', - 'getdlopenflags', 'getrecursionlimit', 'getrefcount', 'hexversion', - 'maxint', 'maxunicode', 'modules', 'path', 'platform', 'prefix', 'ps1', - 'ps2', 'setcheckinterval', 'setdlopenflags', 'setprofile', - 'setrecursionlimit', 'settrace', 'stderr', 'stdin', 'stdout', 'version', - 'version_info', 'warnoptions'] + '__stdin__', '__stdout__', '_getframe', 'api_version', 'argv', + 'builtin_module_names', 'byteorder', 'callstats', 'copyright', + 'displayhook', 'exc_clear', 'exc_info', 'exc_type', 'excepthook', + 'exec_prefix', 'executable', 'exit', 'getdefaultencoding', 'getdlopenflags', + 'getrecursionlimit', 'getrefcount', 'hexversion', 'maxint', 'maxunicode', + 'meta_path', 'modules', 'path', 'path_hooks', 'path_importer_cache', + 'platform', 'prefix', 'ps1', 'ps2', 'setcheckinterval', 'setdlopenflags', + 'setprofile', 'setrecursionlimit', 'settrace', 'stderr', 'stdin', 'stdout', + 'version', 'version_info', 'warnoptions'] \end{verbatim} Without arguments, \function{dir()} lists the names you have defined |