summaryrefslogtreecommitdiff
path: root/Doc/lib/libexcs.tex
diff options
context:
space:
mode:
authorFred Drake <fdrake@acm.org>2000-04-03 20:13:55 +0000
committerFred Drake <fdrake@acm.org>2000-04-03 20:13:55 +0000
commit38e5d27caee56b6958e0034e342abb48e6100390 (patch)
tree6a0c853da853123dd2e628e8ec187517250c2530 /Doc/lib/libexcs.tex
parent659ebfa79e891fc5e2480cd66c157970df57c451 (diff)
downloadcpython-git-38e5d27caee56b6958e0034e342abb48e6100390.tar.gz
Merged changes from the 1.5.2p2 release.
(Very rough.)
Diffstat (limited to 'Doc/lib/libexcs.tex')
-rw-r--r--Doc/lib/libexcs.tex47
1 files changed, 17 insertions, 30 deletions
diff --git a/Doc/lib/libexcs.tex b/Doc/lib/libexcs.tex
index 1c57ee8d71..81532ce2eb 100644
--- a/Doc/lib/libexcs.tex
+++ b/Doc/lib/libexcs.tex
@@ -11,18 +11,6 @@ and users are encouraged to do the same. The source code for those
exceptions is present in the standard library module
\module{exceptions}; this module never needs to be imported explicitly.
-For backward compatibility, when Python is invoked with the
-\programopt{-X} option, most of the standard exceptions are
-strings\footnote{
- For forward-compatibility the new exceptions \exception{Exception},
- \exception{LookupError}, \exception{ArithmeticError},
- \exception{EnvironmentError}, and \exception{StandardError} are
- tuples.
-}. This option may be used to run code that breaks because of the
-different semantics of class based exceptions. The
-\programopt{-X} option will become obsolete in future Python versions,
-so the recommended solution is to fix the code.
-
Two distinct string objects with the same value are considered different
exceptions. This is done to force programmers to use exception names
rather than their string value when specifying exception handlers.
@@ -30,29 +18,27 @@ The string value of all built-in exceptions is their name, but this is
not a requirement for user-defined exceptions or exceptions defined by
library modules.
-For class exceptions, in a \keyword{try} statement with an \keyword{except}
-clause that mentions a particular class, that clause also handles
-any exception classes derived from that class (but not exception
-classes from which \emph{it} is derived). Two exception classes
-that are not related via subclassing are never equivalent, even if
-they have the same name.
-\stindex{try}
-\stindex{except}
+For class exceptions, in a \keyword{try}\stindex{try} statement with
+an \keyword{except}\stindex{except} clause that mentions a particular
+class, that clause also handles any exception classes derived from
+that class (but not exception classes from which \emph{it} is
+derived). Two exception classes that are not related via subclassing
+are never equivalent, even if they have the same name.
The built-in exceptions listed below can be generated by the
interpreter or built-in functions. Except where mentioned, they have
an ``associated value'' indicating the detailed cause of the error.
This may be a string or a tuple containing several items of
information (e.g., an error code and a string explaining the code).
-The associated value is the second argument to the \keyword{raise}
-statement. For string exceptions, the associated value itself will be
-stored in the variable named as the second argument of the
-\keyword{except} clause (if any). For class exceptions, that variable
-receives the exception instance. If the exception class is derived
-from the standard root class \exception{Exception}, the associated
-value is present as the exception instance's \member{args} attribute,
-and possibly on other attributes as well.
-\stindex{raise}
+The associated value is the second argument to the
+\keyword{raise}\stindex{raise} statement. For string exceptions, the
+associated value itself will be stored in the variable named as the
+second argument of the \keyword{except} clause (if any). For class
+exceptions, that variable receives the exception instance. If the
+exception class is derived from the standard root class
+\exception{Exception}, the associated value is present as the
+exception instance's \member{args} attribute, and possibly on other
+attributes as well.
User code can raise built-in exceptions. This can be used to test an
exception handler or to report an error condition ``just like'' the
@@ -65,6 +51,7 @@ inappropriate error.
The following exceptions are only used as base classes for other
exceptions. When string-based standard exceptions are used, they
are tuples containing the directly derived classes.
+\strong{Note:} These will always be classes in Python 1.6.
\begin{excdesc}{Exception}
The root class for exceptions. All built-in exceptions are derived
@@ -128,8 +115,8 @@ They are class objects, except when the \programopt{-X} option is used
to revert back to string-based standard exceptions.
\begin{excdesc}{AssertionError}
-Raised when an \keyword{assert} statement fails.
\stindex{assert}
+Raised when an \keyword{assert} statement fails.
\end{excdesc}
\begin{excdesc}{AttributeError}