Skip to content

Commit 7cb1319

Browse files
committed
Terminology fix: exceptions are raised, except in generator.throw().
1 parent e8e02e3 commit 7cb1319

17 files changed

Lines changed: 32 additions & 32 deletions

Doc/c-api/init.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -959,7 +959,7 @@ Python-level trace functions in previous versions.
959959
.. cvar:: int PyTrace_C_EXCEPTION
960960

961961
The value for the *what* parameter to :ctype:`Py_tracefunc` functions when a C
962-
function has thrown an exception.
962+
function has raised an exception.
963963

964964

965965
.. cvar:: int PyTrace_C_RETURN

Doc/howto/doanddont.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ The following is a very popular anti-idiom ::
154154

155155
Consider the case the file gets deleted between the time the call to
156156
:func:`os.path.exists` is made and the time :func:`open` is called. That means
157-
the last line will throw an :exc:`IOError`. The same would happen if *file*
157+
the last line will raise an :exc:`IOError`. The same would happen if *file*
158158
exists but has no read permission. Since testing this on a normal machine on
159159
existing and non-existing files make it seem bugless, that means in testing the
160160
results will seem fine, and the code will get shipped. Then an unhandled

Doc/library/bdb.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ The :mod:`bdb` module also defines two classes:
116116
* ``"exception"``: An exception has occurred.
117117
* ``"c_call"``: A C function is about to be called.
118118
* ``"c_return"``: A C function has returned.
119-
* ``"c_exception"``: A C function has thrown an exception.
119+
* ``"c_exception"``: A C function has raised an exception.
120120

121121
For the Python events, specialized functions (see below) are called. For
122122
the C events, no action is taken.

Doc/library/doctest.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1673,7 +1673,7 @@ There are two exceptions that may be raised by :class:`DebugRunner` instances:
16731673

16741674
.. exception:: DocTestFailure(test, example, got)
16751675

1676-
An exception thrown by :class:`DocTestRunner` to signal that a doctest example's
1676+
An exception raised by :class:`DocTestRunner` to signal that a doctest example's
16771677
actual output did not match its expected output. The constructor arguments are
16781678
used to initialize the member variables of the same names.
16791679

@@ -1697,9 +1697,9 @@ There are two exceptions that may be raised by :class:`DebugRunner` instances:
16971697

16981698
.. exception:: UnexpectedException(test, example, exc_info)
16991699

1700-
An exception thrown by :class:`DocTestRunner` to signal that a doctest example
1701-
raised an unexpected exception. The constructor arguments are used to
1702-
initialize the member variables of the same names.
1700+
An exception raised by :class:`DocTestRunner` to signal that a doctest
1701+
example raised an unexpected exception. The constructor arguments are used
1702+
to initialize the member variables of the same names.
17031703

17041704
:exc:`UnexpectedException` defines the following member variables:
17051705

Doc/library/email.errors.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ The following exception classes are defined in the :mod:`email.errors` module:
1717

1818
.. exception:: MessageParseError()
1919

20-
This is the base class for exceptions thrown by the :class:`~email.parser.Parser`
20+
This is the base class for exceptions raised by the :class:`~email.parser.Parser`
2121
class. It is derived from :exc:`MessageError`.
2222

2323

Doc/library/html.parser.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ An exception is defined as well:
145145
Method called when an unrecognized SGML declaration is read by the parser.
146146
The *data* parameter will be the entire contents of the declaration inside
147147
the ``<!...>`` markup. It is sometimes useful to be be overridden by a
148-
derived class; the base class implementation throws an :exc:`HTMLParseError`.
148+
derived class; the base class implementation raises an :exc:`HTMLParseError`.
149149

150150

151151
.. method:: HTMLParser.handle_pi(data)

Doc/library/io.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ built-in :func:`open` function is defined in this module.
1717
At the top of the I/O hierarchy is the abstract base class :class:`IOBase`. It
1818
defines the basic interface to a stream. Note, however, that there is no
1919
separation between reading and writing to streams; implementations are allowed
20-
to throw an :exc:`IOError` if they do not support a given operation.
20+
to raise an :exc:`IOError` if they do not support a given operation.
2121

2222
Extending :class:`IOBase` is :class:`RawIOBase` which deals simply with the
2323
reading and writing of raw bytes to a stream. :class:`FileIO` subclasses

Doc/library/linecache.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ The :mod:`linecache` module defines the following functions:
1616

1717
.. function:: getline(filename, lineno, module_globals=None)
1818

19-
Get line *lineno* from file named *filename*. This function will never throw an
19+
Get line *lineno* from file named *filename*. This function will never raise an
2020
exception --- it will return ``''`` on errors (the terminating newline character
2121
will be included for lines that are found).
2222

Doc/library/mmap.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ To map anonymous memory, -1 should be passed as the fileno along with the length
184184

185185
Copy the *count* bytes starting at offset *src* to the destination index
186186
*dest*. If the mmap was created with :const:`ACCESS_READ`, then calls to
187-
move will throw a :exc:`TypeError` exception.
187+
move will raise a :exc:`TypeError` exception.
188188

189189

190190
.. method:: read(num)
@@ -210,7 +210,7 @@ To map anonymous memory, -1 should be passed as the fileno along with the length
210210

211211
Resizes the map and the underlying file, if any. If the mmap was created
212212
with :const:`ACCESS_READ` or :const:`ACCESS_COPY`, resizing the map will
213-
throw a :exc:`TypeError` exception.
213+
raise a :exc:`TypeError` exception.
214214

215215

216216
.. method:: rfind(sub[, start[, end]])
@@ -245,12 +245,12 @@ To map anonymous memory, -1 should be passed as the fileno along with the length
245245
Write the bytes in *bytes* into memory at the current position of the
246246
file pointer; the file position is updated to point after the bytes that
247247
were written. If the mmap was created with :const:`ACCESS_READ`, then
248-
writing to it will throw a :exc:`TypeError` exception.
248+
writing to it will raise a :exc:`TypeError` exception.
249249

250250

251251
.. method:: write_byte(byte)
252252

253253
Write the the integer *byte* into memory at the current
254254
position of the file pointer; the file position is advanced by ``1``. If
255255
the mmap was created with :const:`ACCESS_READ`, then writing to it will
256-
throw a :exc:`TypeError` exception.
256+
raise a :exc:`TypeError` exception.

Doc/library/parser.rst

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -114,15 +114,15 @@ and ``'exec'`` forms.
114114
The :func:`expr` function parses the parameter *source* as if it were an input
115115
to ``compile(source, 'file.py', 'eval')``. If the parse succeeds, an ST object
116116
is created to hold the internal parse tree representation, otherwise an
117-
appropriate exception is thrown.
117+
appropriate exception is raised.
118118

119119

120120
.. function:: suite(source)
121121

122122
The :func:`suite` function parses the parameter *source* as if it were an input
123123
to ``compile(source, 'file.py', 'exec')``. If the parse succeeds, an ST object
124124
is created to hold the internal parse tree representation, otherwise an
125-
appropriate exception is thrown.
125+
appropriate exception is raised.
126126

127127

128128
.. function:: sequence2st(sequence)
@@ -132,9 +132,9 @@ and ``'exec'`` forms.
132132
to the Python grammar and all nodes are valid node types in the host version of
133133
Python, an ST object is created from the internal representation and returned
134134
to the called. If there is a problem creating the internal representation, or
135-
if the tree cannot be validated, a :exc:`ParserError` exception is thrown. An
135+
if the tree cannot be validated, a :exc:`ParserError` exception is raised. An
136136
ST object created this way should not be assumed to compile correctly; normal
137-
exceptions thrown by compilation may still be initiated when the ST object is
137+
exceptions raised by compilation may still be initiated when the ST object is
138138
passed to :func:`compilest`. This may indicate problems not related to syntax
139139
(such as a :exc:`MemoryError` exception), but may also be due to constructs such
140140
as the result of parsing ``del f(0)``, which escapes the Python parser but is
@@ -259,16 +259,16 @@ function for information about the exceptions it can raise.
259259
.. exception:: ParserError
260260

261261
Exception raised when a failure occurs within the parser module. This is
262-
generally produced for validation failures rather than the built in
263-
:exc:`SyntaxError` thrown during normal parsing. The exception argument is
262+
generally produced for validation failures rather than the built-in
263+
:exc:`SyntaxError` raised during normal parsing. The exception argument is
264264
either a string describing the reason of the failure or a tuple containing a
265265
sequence causing the failure from a parse tree passed to :func:`sequence2st`
266266
and an explanatory string. Calls to :func:`sequence2st` need to be able to
267267
handle either type of exception, while calls to other functions in the module
268268
will only need to be aware of the simple string values.
269269

270270
Note that the functions :func:`compilest`, :func:`expr`, and :func:`suite` may
271-
throw exceptions which are normally thrown by the parsing and compilation
271+
raise exceptions which are normally thrown by the parsing and compilation
272272
process. These include the built in exceptions :exc:`MemoryError`,
273273
:exc:`OverflowError`, :exc:`SyntaxError`, and :exc:`SystemError`. In these
274274
cases, these exceptions carry all the meaning normally associated with them.

0 commit comments

Comments
 (0)