Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
8e7f9d2f
Commit
8e7f9d2f
authored
May 29, 2003
by
Neal Norwitz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SF bug #719367, string exceptions are deprecated
Remove references to string based exceptions in the doc.
parent
6b9c0cf3
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
19 additions
and
22 deletions
+19
-22
Doc/api/exceptions.tex
Doc/api/exceptions.tex
+2
-2
Doc/doc/doc.tex
Doc/doc/doc.tex
+2
-3
Doc/lib/libexcs.tex
Doc/lib/libexcs.tex
+9
-4
Doc/lib/libsys.tex
Doc/lib/libsys.tex
+1
-1
Doc/ref/ref4.tex
Doc/ref/ref4.tex
+3
-6
Doc/ref/ref6.tex
Doc/ref/ref6.tex
+2
-6
No files found.
Doc/api/exceptions.tex
View file @
8e7f9d2f
...
...
@@ -102,7 +102,7 @@ for each thread.
indicator is already set, it is cleared first. If the objects are
\NULL
, the error indicator is cleared. Do not pass a
\NULL
{}
type
and non-
\NULL
{}
value or traceback. The exception type should be a
string or
class. Do not pass an invalid exception type or value.
class. Do not pass an invalid exception type or value.
(Violating these rules will cause subtle problems later.) This call
takes away a reference to each object: you must own a reference to
each object before the call and after the call you no longer own
...
...
@@ -130,7 +130,7 @@ for each thread.
\begin{cfuncdesc}
{
PyObject*
}{
PyErr
_
Format
}{
PyObject *exception,
const char *format,
\moreargs
}
This function sets the error indicator and returns
\NULL
.
\var
{
exception
}
should be a Python exception (
string or
class, not
\var
{
exception
}
should be a Python exception (class, not
an instance).
\var
{
format
}
should be a string, containing format
codes, similar to
\cfunction
{
printf()
}
. The
\code
{
width.precision
}
before a format code is parsed, but the width part is ignored.
...
...
Doc/doc/doc.tex
View file @
8e7f9d2f
...
...
@@ -608,8 +608,7 @@ This \UNIX\ is also followed by a space.
\end{envdesc}
\begin{envdesc}
{
excdesc
}{
\p
{
name
}}
Describe an exception. This may be either a string exception or
a class exception. In the case of class exceptions, the
Describe an exception. In the case of class exceptions, the
constructor parameters are not described; use
\env
{
excclassdesc
}
to describe an exception class and its constructor.
\end{envdesc}
...
...
@@ -1498,7 +1497,7 @@ This \UNIX\ is also followed by a space.
\begin{macrodesc}
{
exindex
}{
\p
{
exception
}}
Add a reference to an exception named
\var
{
exception
}
. The
exception
may be either string- or
class-based.
exception
should be
class-based.
\end{macrodesc}
\begin{macrodesc}
{
kwindex
}{
\p
{
keyword
}}
...
...
Doc/lib/libexcs.tex
View file @
8e7f9d2f
...
...
@@ -4,21 +4,26 @@
\modulesynopsis
{
Standard exception classes.
}
Exceptions can be class objects or string objects. Though most
exceptions have been string objects in past versions of Python, in
Python 1.5 and newer versions, all standard exceptions have been
converted to class objects, and users are encouraged to do the same.
Exceptions should be class objects.
The exceptions are defined in the module
\module
{
exceptions
}
. This
module never needs to be imported explicitly: the exceptions are
provided in the built-in namespace as well as the
\module
{
exceptions
}
module.
\begin{notice}
In past versions of Python string exceptions were supported. In
Python 1.5 and newer versions, all standard exceptions have been
converted to class objects and users are encouraged to do the same.
String exceptions will raise a
\code
{
PendingDeprecationWarning
}
.
In future versions, support for string exceptions will be removed.
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.
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.
\end{notice}
For class exceptions, in a
\keyword
{
try
}
\stindex
{
try
}
statement with
an
\keyword
{
except
}
\stindex
{
except
}
clause that mentions a particular
...
...
Doc/lib/libsys.tex
View file @
8e7f9d2f
...
...
@@ -91,7 +91,7 @@ It is always available.
containing three
\code
{
None
}
values is returned. Otherwise, the
values returned are
\code
{
(
\var
{
type
}
,
\var
{
value
}
,
\var
{
traceback
}
)
}
. Their meaning is:
\var
{
type
}
gets the exception
type of the exception being handled (a
string or
class object);
type of the exception being handled (a class object);
\var
{
value
}
gets the exception parameter (its
\dfn
{
associated value
}
or the second argument to
\keyword
{
raise
}
, which is always a class
instance if the exception type is a class object);
\var
{
traceback
}
...
...
Doc/ref/ref4.tex
View file @
8e7f9d2f
...
...
@@ -183,12 +183,9 @@ either case, it prints a stack backtrace, except when the exception is
\exception
{
SystemExit
}
\withsubitem
{
(built-in
exception)
}{
\ttindex
{
SystemExit
}}
.
Exceptions are identified by string objects or class instances.
Selection of a matching except clause is based on object identity
(i.e., two different string objects with the same value represent
different exceptions!) For string exceptions, the
\keyword
{
except
}
clause must reference the same string object. For class exceptions,
the
\keyword
{
except
}
clause must reference the same class or a base
Exceptions are identified by class instances.
Selection of a matching except clause is based on object identity.
The
\keyword
{
except
}
clause must reference the same class or a base
class of it.
When an exception is raised, an object (maybe
\code
{
None
}
) is passed
...
...
Doc/ref/ref6.tex
View file @
8e7f9d2f
...
...
@@ -521,9 +521,8 @@ from __future__ import generators
\end{productionlist}
If no expressions are present,
\keyword
{
raise
}
re-raises the last
expression that was active in the current scope. If no exception has
been active in the current scope, an exception is raised that
indicates indicates that this is the error.
expression that was active in the current scope. If no exception is
active in the current scope, an exception is raised indicating this error.
\index
{
exception
}
\indexii
{
raising
}{
exception
}
...
...
@@ -545,9 +544,6 @@ used, and any other object is treated as a single argument to the
constructor. The instance so created by calling the constructor is
used as the exception value.
If the first object is a string, the string object is the exception
type, and the second object becomes the exception value.
If a third object is present and not
\code
{
None
}
, it must be a
traceback
\obindex
{
traceback
}
object (see section~
\ref
{
traceback
}
), and
it is substituted instead of the current location as the place where
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment