File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -532,12 +532,13 @@ \section{The standard type hierarchy} \label{types}
532532\ttindex {f_lineno}
533533\ttindex {f_lasti}
534534
535- \item [Traceback objects]
535+ \item [Traceback objects] \label { traceback }
536536Traceback objects represent a stack trace of an exception. A
537537traceback object is created when an exception occurs. When the search
538538for an exception handler unwinds the execution stack, at each unwound
539539level a traceback object is inserted in front of the current
540- traceback. When an exception handler is entered, the stack trace is
540+ traceback. When an exception handler is entered
541+ (see also section \ref {try }), the stack trace is
541542made available to the program as \verb \sys.exc_traceback \. When the
542543program contains no suitable handler, the stack trace is written
543544(nicely formatted) to the standard error stream; if the interpreter is
Original file line number Diff line number Diff line change @@ -172,7 +172,7 @@ \section{The {\tt for} statement}
172172 if x < 0: a.remove(x)
173173\end {verbatim }
174174
175- \section {The {\tt try} statement }
175+ \section {The {\tt try} statement } \label { try }
176176\stindex {try}
177177
178178The \verb \try \ statement specifies exception handlers and/or cleanup
@@ -222,6 +222,19 @@ \section{The {\tt try} statement}
222222exception, and the exception occurs in the try clause of the inner
223223handler, the outer handler will not handle the exception.)
224224
225+ Before an except clause's suite is executed, details about the
226+ exception are assigned to three variables in the \verb \sys \ module:
227+ \verb \sys.exc_type \ receives the object identifying the exception;
228+ \verb \sys.exc_value \ receives the exception's parameter;
229+ \verb \sys.exc_traceback \ receives a traceback object (see section
230+ \ref {traceback }) identifying the point in the program where the
231+ exception occurred.
232+ \bimodindex {sys}
233+ \ttindex {exc_type}
234+ \ttindex {exc_value}
235+ \ttindex {exc_traceback}
236+ \obindex {traceback}
237+
225238The \verb \try...finally \ form specifies a `cleanup' handler. The
226239\verb \try \ clause is executed. When no exception occurs, the
227240\verb \finally \ clause is executed. When an exception occurs in the
Original file line number Diff line number Diff line change @@ -532,12 +532,13 @@ \section{The standard type hierarchy} \label{types}
532532\ttindex {f_lineno}
533533\ttindex {f_lasti}
534534
535- \item [Traceback objects]
535+ \item [Traceback objects] \label { traceback }
536536Traceback objects represent a stack trace of an exception. A
537537traceback object is created when an exception occurs. When the search
538538for an exception handler unwinds the execution stack, at each unwound
539539level a traceback object is inserted in front of the current
540- traceback. When an exception handler is entered, the stack trace is
540+ traceback. When an exception handler is entered
541+ (see also section \ref {try }), the stack trace is
541542made available to the program as \verb \sys.exc_traceback \. When the
542543program contains no suitable handler, the stack trace is written
543544(nicely formatted) to the standard error stream; if the interpreter is
Original file line number Diff line number Diff line change @@ -172,7 +172,7 @@ \section{The {\tt for} statement}
172172 if x < 0: a.remove(x)
173173\end {verbatim }
174174
175- \section {The {\tt try} statement }
175+ \section {The {\tt try} statement } \label { try }
176176\stindex {try}
177177
178178The \verb \try \ statement specifies exception handlers and/or cleanup
@@ -222,6 +222,19 @@ \section{The {\tt try} statement}
222222exception, and the exception occurs in the try clause of the inner
223223handler, the outer handler will not handle the exception.)
224224
225+ Before an except clause's suite is executed, details about the
226+ exception are assigned to three variables in the \verb \sys \ module:
227+ \verb \sys.exc_type \ receives the object identifying the exception;
228+ \verb \sys.exc_value \ receives the exception's parameter;
229+ \verb \sys.exc_traceback \ receives a traceback object (see section
230+ \ref {traceback }) identifying the point in the program where the
231+ exception occurred.
232+ \bimodindex {sys}
233+ \ttindex {exc_type}
234+ \ttindex {exc_value}
235+ \ttindex {exc_traceback}
236+ \obindex {traceback}
237+
225238The \verb \try...finally \ form specifies a `cleanup' handler. The
226239\verb \try \ clause is executed. When no exception occurs, the
227240\verb \finally \ clause is executed. When an exception occurs in the
You can’t perform that action at this time.
0 commit comments