Mercurial > cpython-lru_cache-weakref
diff Doc/lib/libsys.tex @ 28119:869695cba2cd legacy-trunk
- 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!
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Sat, 01 Mar 2003 03:20:41 +0000 |
| parents | 4a825b902310 |
| children | 3f90d21debe9 |
line wrap: on
line diff
--- a/Doc/lib/libsys.tex Sat Mar 01 01:48:24 2003 +0000 +++ b/Doc/lib/libsys.tex Sat Mar 01 03:20:41 2003 +0000 @@ -99,6 +99,11 @@ 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 @@ 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}
