diff options
author | Neal Norwitz <nnorwitz@gmail.com> | 2006-03-17 05:49:33 (GMT) |
---|---|---|
committer | Neal Norwitz <nnorwitz@gmail.com> | 2006-03-17 05:49:33 (GMT) |
commit | ac3625fcb95c2c54e40e1a27f2395811adbed03e (patch) | |
tree | 7ef987a510e3ad2e43ee67ca6854cd6af23673f9 /Doc | |
parent | fc85c92a85e08d39ea769a07a3dc2a3c83c21477 (diff) | |
download | cpython-ac3625fcb95c2c54e40e1a27f2395811adbed03e.zip cpython-ac3625fcb95c2c54e40e1a27f2395811adbed03e.tar.gz cpython-ac3625fcb95c2c54e40e1a27f2395811adbed03e.tar.bz2 |
Remove sys.exc_type, sys.exc_value, sys.exc_traceback
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/api/exceptions.tex | 9 | ||||
-rw-r--r-- | Doc/api/intro.tex | 7 | ||||
-rw-r--r-- | Doc/ext/extending.tex | 5 | ||||
-rw-r--r-- | Doc/lib/libtraceback.tex | 11 | ||||
-rw-r--r-- | Doc/ref/ref7.tex | 20 |
5 files changed, 17 insertions, 35 deletions
diff --git a/Doc/api/exceptions.tex b/Doc/api/exceptions.tex index c4727f2..62f713b 100644 --- a/Doc/api/exceptions.tex +++ b/Doc/api/exceptions.tex @@ -23,12 +23,9 @@ carefully propagated, additional calls into the Python/C API may not behave as intended and may fail in mysterious ways. The error indicator consists of three Python objects corresponding to -\withsubitem{(in module sys)}{ - \ttindex{exc_type}\ttindex{exc_value}\ttindex{exc_traceback}} -the Python variables \code{sys.exc_type}, \code{sys.exc_value} and -\code{sys.exc_traceback}. API functions exist to interact with the -error indicator in various ways. There is a separate error indicator -for each thread. +the result of \code{sys.exc_info()}. API functions exist to interact +with the error indicator in various ways. There is a separate +error indicator for each thread. % XXX Order of these should be more thoughtful. % Either alphabetical or some kind of structure. diff --git a/Doc/api/intro.tex b/Doc/api/intro.tex index d84b654..608d562 100644 --- a/Doc/api/intro.tex +++ b/Doc/api/intro.tex @@ -400,15 +400,12 @@ exception state. The full exception state consists of three objects (all of which can be \NULL): the exception type, the corresponding exception value, and the traceback. These have the same meanings as the Python -\withsubitem{(in module sys)}{ - \ttindex{exc_type}\ttindex{exc_value}\ttindex{exc_traceback}} -objects \code{sys.exc_type}, \code{sys.exc_value}, and -\code{sys.exc_traceback}; however, they are not the same: the Python +result of \code{sys.exc_info()}; however, they are not the same: the Python objects represent the last exception being handled by a Python \keyword{try} \ldots\ \keyword{except} statement, while the C level exception state only exists while an exception is being passed on between C functions until it reaches the Python bytecode interpreter's -main loop, which takes care of transferring it to \code{sys.exc_type} +main loop, which takes care of transferring it to \code{sys.exc_info()} and friends. Note that starting with Python 1.5, the preferred, thread-safe way to diff --git a/Doc/ext/extending.tex b/Doc/ext/extending.tex index 7016f94..0e2fd14 100644 --- a/Doc/ext/extending.tex +++ b/Doc/ext/extending.tex @@ -120,9 +120,8 @@ variable is \NULL{} no exception has occurred. A second global variable stores the ``associated value'' of the exception (the second argument to \keyword{raise}). A third variable contains the stack traceback in case the error originated in Python code. These three -variables are the C equivalents of the Python variables -\code{sys.exc_type}, \code{sys.exc_value} and \code{sys.exc_traceback} (see -the section on module \module{sys} in the +variables are the C equivalents of the result in Python of +\method{sys.exc_info()} (see the section on module \module{sys} in the \citetitle[../lib/lib.html]{Python Library Reference}). It is important to know about them to understand how errors are passed around. diff --git a/Doc/lib/libtraceback.tex b/Doc/lib/libtraceback.tex index b7f61ac..80dc423 100644 --- a/Doc/lib/libtraceback.tex +++ b/Doc/lib/libtraceback.tex @@ -12,9 +12,8 @@ when you want to print stack traces under program control, such as in a ``wrapper'' around the interpreter. The module uses traceback objects --- this is the object type that is -stored in the variables \code{sys.exc_traceback} (deprecated) and -\code{sys.last_traceback} and returned as the third item from -\function{sys.exc_info()}. +stored in the \code{sys.last_traceback} variable and returned +as the third item from \function{sys.exc_info()}. \obindex{traceback} The module defines the following functions: @@ -41,11 +40,7 @@ with a caret indicating the approximate position of the error. \end{funcdesc} \begin{funcdesc}{print_exc}{\optional{limit\optional{, file}}} -This is a shorthand for \code{print_exception(sys.exc_type, -sys.exc_value, sys.exc_traceback, \var{limit}, \var{file})}. (In -fact, it uses \function{sys.exc_info()} to retrieve the same -information in a thread-safe way instead of using the deprecated -variables.) +This is a shorthand for \code{print_exception(*\function{sys.exc_info()}}. \end{funcdesc} \begin{funcdesc}{format_exc}{\optional{limit}} diff --git a/Doc/ref/ref7.tex b/Doc/ref/ref7.tex index 4ae6040..90627a4 100644 --- a/Doc/ref/ref7.tex +++ b/Doc/ref/ref7.tex @@ -250,21 +250,15 @@ occurs in the try clause of the inner handler, the outer handler will not handle the exception.) Before an except clause's suite is executed, details about the -exception are assigned to three variables in the -\module{sys}\refbimodindex{sys} module: \code{sys.exc_type} receives -the object identifying the exception; \code{sys.exc_value} receives -the exception's parameter; \code{sys.exc_traceback} receives a +exception are stored in the \module{sys}\refbimodindex{sys} module +and can be access via \function{sys.exc_info()}. \function{sys.exc_info()} +returns a 3-tuple consisting of: \code{exc_type} receives +the object identifying the exception; \code{exc_value} receives +the exception's parameter; \code{exc_traceback} receives a traceback object\obindex{traceback} (see section~\ref{traceback}) identifying the point in the program where the exception occurred. -These details are also available through the \function{sys.exc_info()} -function, which returns a tuple \code{(\var{exc_type}, \var{exc_value}, -\var{exc_traceback})}. Use of the corresponding variables is -deprecated in favor of this function, since their use is unsafe in a -threaded program. As of Python 1.5, the variables are restored to -their previous values (before the call) when returning from a function -that handled an exception. -\withsubitem{(in module sys)}{\ttindex{exc_type} - \ttindex{exc_value}\ttindex{exc_traceback}} +\function{sys.exc_info()} values are restored to their previous values +(before the call) when returning from a function that handled an exception. The optional \keyword{else} clause is executed if and when control flows off the end of the \keyword{try} clause.\footnote{ |