summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Svetlov <andrew.svetlov@gmail.com>2012-12-18 19:27:16 (GMT)
committerAndrew Svetlov <andrew.svetlov@gmail.com>2012-12-18 19:27:16 (GMT)
commita19195984922ce89e7695c93b3bb45c3e0e6d732 (patch)
tree2cbafae7aa7aa368583be6216a0c23bce0774a0f
parentf61dc4cea24c2e994dc11947a6d67708af87ce50 (diff)
parent5b89840d9cf11014a4b865d79497649f74bf2866 (diff)
downloadcpython-a19195984922ce89e7695c93b3bb45c3e0e6d732.zip
cpython-a19195984922ce89e7695c93b3bb45c3e0e6d732.tar.gz
cpython-a19195984922ce89e7695c93b3bb45c3e0e6d732.tar.bz2
Issue #16714: use 'raise' exceptions, don't 'throw'.
Patch by Serhiy Storchaka.
-rw-r--r--Doc/howto/cporting.rst2
-rw-r--r--Doc/library/contextlib.rst2
-rw-r--r--Doc/library/imaplib.rst2
-rw-r--r--Doc/library/os.rst8
-rw-r--r--Lib/asyncore.py2
-rw-r--r--Lib/contextlib.py2
-rw-r--r--Lib/distutils/tests/test_msvc9compiler.py2
-rw-r--r--Lib/email/feedparser.py4
-rw-r--r--Lib/email/header.py2
-rw-r--r--Lib/email/utils.py2
-rw-r--r--Lib/imaplib.py2
-rw-r--r--Lib/io.py2
-rw-r--r--Lib/logging/__init__.py2
-rw-r--r--Lib/multiprocessing/util.py2
-rw-r--r--Lib/pkgutil.py2
-rw-r--r--Lib/tempfile.py2
-rw-r--r--Lib/test/test_codeop.py2
-rw-r--r--Lib/test/test_docxmlrpc.py2
-rw-r--r--Lib/test/test_imaplib.py2
-rw-r--r--Lib/test/test_minidom.py2
-rw-r--r--Lib/test/test_os.py16
-rw-r--r--Lib/test/test_posix.py4
-rw-r--r--Lib/test/test_pty.py2
-rw-r--r--Lib/test/test_sax.py4
-rw-r--r--Lib/test/test_signal.py4
-rw-r--r--Lib/test/test_socketserver.py2
-rw-r--r--Lib/test/test_sys_settrace.py2
-rw-r--r--Lib/test/test_time.py2
-rw-r--r--Lib/test/test_uu.py4
-rw-r--r--Lib/test/test_winreg.py4
-rw-r--r--Lib/test/test_zipfile.py2
-rw-r--r--Lib/tkinter/__init__.py2
-rw-r--r--Lib/unittest/case.py4
-rw-r--r--Lib/wsgiref/validate.py4
-rw-r--r--Lib/xml/sax/_exceptions.py6
-rw-r--r--Lib/xml/sax/xmlreader.py2
-rw-r--r--Lib/xmlrpc/client.py2
-rw-r--r--Modules/_io/_iomodule.c2
-rw-r--r--Modules/parsermodule.c6
-rw-r--r--Modules/posixmodule.c2
-rwxr-xr-xTools/scripts/find_recursionlimit.py2
-rwxr-xr-xTools/scripts/serve.py2
42 files changed, 64 insertions, 64 deletions
diff --git a/Doc/howto/cporting.rst b/Doc/howto/cporting.rst
index 6dd0765..9d8a1b0 100644
--- a/Doc/howto/cporting.rst
+++ b/Doc/howto/cporting.rst
@@ -253,7 +253,7 @@ behave slightly differently from real Capsules. Specifically:
* :c:func:`PyCapsule_GetName` always returns NULL.
- * :c:func:`PyCapsule_SetName` always throws an exception and
+ * :c:func:`PyCapsule_SetName` always raises an exception and
returns failure. (Since there's no way to store a name
in a CObject, noisy failure of :c:func:`PyCapsule_SetName`
was deemed preferable to silent failure here. If this is
diff --git a/Doc/library/contextlib.rst b/Doc/library/contextlib.rst
index ed9ebb8..41dfded 100644
--- a/Doc/library/contextlib.rst
+++ b/Doc/library/contextlib.rst
@@ -184,7 +184,7 @@ Functions and classes provided:
files = [stack.enter_context(open(fname)) for fname in filenames]
# All opened files will automatically be closed at the end of
# the with statement, even if attempts to open files later
- # in the list throw an exception
+ # in the list raise an exception
Each instance maintains a stack of registered callbacks that are called in
reverse order when the instance is closed (either explicitly or implicitly
diff --git a/Doc/library/imaplib.rst b/Doc/library/imaplib.rst
index fefb284..626f661 100644
--- a/Doc/library/imaplib.rst
+++ b/Doc/library/imaplib.rst
@@ -75,7 +75,7 @@ There's also a subclass for secure connections:
:class:`ssl.SSLContext` object which allows bundling SSL configuration
options, certificates and private keys into a single (potentially long-lived)
structure. Note that the *keyfile*/*certfile* parameters are mutually exclusive with *ssl_context*,
- a :class:`ValueError` is thrown if *keyfile*/*certfile* is provided along with *ssl_context*.
+ a :class:`ValueError` is raised if *keyfile*/*certfile* is provided along with *ssl_context*.
.. versionchanged:: 3.3
*ssl_context* parameter added.
diff --git a/Doc/library/os.rst b/Doc/library/os.rst
index a82b401..d2f7d01 100644
--- a/Doc/library/os.rst
+++ b/Doc/library/os.rst
@@ -1171,7 +1171,7 @@ Querying the size of a terminal
output) specifies which file descriptor should be queried.
If the file descriptor is not connected to a terminal, an :exc:`OSError`
- is thrown.
+ is raised.
:func:`shutil.get_terminal_size` is the high-level function which
should normally be used, ``os.get_terminal_size`` is the low-level
@@ -1945,7 +1945,7 @@ features:
:mod:`os` module permit use of their *dir_fd* parameter. Different platforms
provide different functionality, and an option that might work on one might
be unsupported on another. For consistency's sakes, functions that support
- *dir_fd* always allow specifying the parameter, but will throw an exception
+ *dir_fd* always allow specifying the parameter, but will raise an exception
if the functionality is not actually available.
To check whether a particular function permits use of its *dir_fd*
@@ -1986,7 +1986,7 @@ features:
descriptor. Different platforms provide different functionality, and an
option that might work on one might be unsupported on another. For
consistency's sakes, functions that support *fd* always allow specifying
- the parameter, but will throw an exception if the functionality is not
+ the parameter, but will raise an exception if the functionality is not
actually available.
To check whether a particular function permits specifying an open file
@@ -2007,7 +2007,7 @@ features:
platforms provide different functionality, and an option that might work on
one might be unsupported on another. For consistency's sakes, functions that
support *follow_symlinks* always allow specifying the parameter, but will
- throw an exception if the functionality is not actually available.
+ raise an exception if the functionality is not actually available.
To check whether a particular function permits use of its *follow_symlinks*
parameter, use the ``in`` operator on ``supports_follow_symlinks``. As an
diff --git a/Lib/asyncore.py b/Lib/asyncore.py
index 2cac88b..909d9f6 100644
--- a/Lib/asyncore.py
+++ b/Lib/asyncore.py
@@ -385,7 +385,7 @@ class dispatcher:
else:
return data
except socket.error as why:
- # winsock sometimes throws ENOTCONN
+ # winsock sometimes raises ENOTCONN
if why.args[0] in _DISCONNECTED:
self.handle_close()
return b''
diff --git a/Lib/contextlib.py b/Lib/contextlib.py
index bde2feb..0b6bf71 100644
--- a/Lib/contextlib.py
+++ b/Lib/contextlib.py
@@ -151,7 +151,7 @@ class ExitStack(object):
files = [stack.enter_context(open(fname)) for fname in filenames]
# All opened files will automatically be closed at the end of
# the with statement, even if attempts to open files later
- # in the list throw an exception
+ # in the list raise an exception
"""
def __init__(self):
diff --git a/Lib/distutils/tests/test_msvc9compiler.py b/Lib/distutils/tests/test_msvc9compiler.py
index 5fa1ca1..301d43d 100644
--- a/Lib/distutils/tests/test_msvc9compiler.py
+++ b/Lib/distutils/tests/test_msvc9compiler.py
@@ -104,7 +104,7 @@ class msvc9compilerTestCase(support.TempdirManager,
unittest.TestCase):
def test_no_compiler(self):
- # makes sure query_vcvarsall throws
+ # makes sure query_vcvarsall raises
# a DistutilsPlatformError if the compiler
# is not found
from distutils.msvc9compiler import query_vcvarsall
diff --git a/Lib/email/feedparser.py b/Lib/email/feedparser.py
index 56f50df..ea41e95 100644
--- a/Lib/email/feedparser.py
+++ b/Lib/email/feedparser.py
@@ -13,7 +13,7 @@ parser. It returns when there's nothing more it can do with the available
data. When you have no more data to push into the parser, call .close().
This completes the parsing and returns the root message object.
-The other advantage of this parser is that it will never throw a parsing
+The other advantage of this parser is that it will never raise a parsing
exception. Instead, when it finds something unexpected, it adds a 'defect' to
the current message. Defects are just instances that live on the message
object's .defects attribute.
@@ -228,7 +228,7 @@ class FeedParser:
# supposed to see in the body of the message.
self._parse_headers(headers)
# Headers-only parsing is a backwards compatibility hack, which was
- # necessary in the older parser, which could throw errors. All
+ # necessary in the older parser, which could raise errors. All
# remaining lines in the input are thrown into the message body.
if self._headersonly:
lines = []
diff --git a/Lib/email/header.py b/Lib/email/header.py
index a89219d..5bd0638 100644
--- a/Lib/email/header.py
+++ b/Lib/email/header.py
@@ -298,7 +298,7 @@ class Header:
else:
s = s.decode(input_charset, errors)
# Ensure that the bytes we're storing can be decoded to the output
- # character set, otherwise an early error is thrown.
+ # character set, otherwise an early error is raised.
output_charset = charset.output_codec or 'us-ascii'
if output_charset != _charset.UNKNOWN8BIT:
try:
diff --git a/Lib/email/utils.py b/Lib/email/utils.py
index 6b6d7f4..93a625c 100644
--- a/Lib/email/utils.py
+++ b/Lib/email/utils.py
@@ -83,7 +83,7 @@ def formataddr(pair, charset='utf-8'):
'utf-8'.
"""
name, address = pair
- # The address MUST (per RFC) be ascii, so throw a UnicodeError if it isn't.
+ # The address MUST (per RFC) be ascii, so raise an UnicodeError if it isn't.
address.encode('ascii')
if name:
try:
diff --git a/Lib/imaplib.py b/Lib/imaplib.py
index e16fb95..3f8c65a 100644
--- a/Lib/imaplib.py
+++ b/Lib/imaplib.py
@@ -1178,7 +1178,7 @@ if HAVE_SSL:
ssl_context - a SSLContext object that contains your certificate chain
and private key (default: None)
Note: if ssl_context is provided, then parameters keyfile or
- certfile should not be set otherwise ValueError is thrown.
+ certfile should not be set otherwise ValueError is raised.
for more documentation see the docstring of the parent class IMAP4.
"""
diff --git a/Lib/io.py b/Lib/io.py
index cfb70ac..bda4def 100644
--- a/Lib/io.py
+++ b/Lib/io.py
@@ -4,7 +4,7 @@ builtin open function is defined in this module.
At the top of the I/O hierarchy is the abstract base class IOBase. It
defines the basic interface to a stream. Note, however, that there is no
separation between reading and writing to streams; implementations are
-allowed to throw an IOError if they do not support a given operation.
+allowed to raise an IOError if they do not support a given operation.
Extending IOBase is RawIOBase which deals simply with the reading and
writing of raw bytes to a stream. FileIO subclasses RawIOBase to provide
diff --git a/Lib/logging/__init__.py b/Lib/logging/__init__.py
index 9242023..6f8b4fa 100644
--- a/Lib/logging/__init__.py
+++ b/Lib/logging/__init__.py
@@ -1358,7 +1358,7 @@ class Logger(Filterer):
"""
sinfo = None
if _srcfile:
- #IronPython doesn't track Python frames, so findCaller throws an
+ #IronPython doesn't track Python frames, so findCaller raises an
#exception on some versions of IronPython. We trap it here so that
#IronPython can use logging.
try:
diff --git a/Lib/multiprocessing/util.py b/Lib/multiprocessing/util.py
index 7495813..72385a8 100644
--- a/Lib/multiprocessing/util.py
+++ b/Lib/multiprocessing/util.py
@@ -290,7 +290,7 @@ def _exit_function(info=info, debug=debug, _run_finalizers=_run_finalizers,
if current_process() is not None:
# We check if the current process is None here because if
- # it's None, any call to ``active_children()`` will throw
+ # it's None, any call to ``active_children()`` will raise
# an AttributeError (active_children winds up trying to
# get attributes from util._current_process). One
# situation where this can happen is if someone has
diff --git a/Lib/pkgutil.py b/Lib/pkgutil.py
index c695cf1..7ff247f 100644
--- a/Lib/pkgutil.py
+++ b/Lib/pkgutil.py
@@ -502,7 +502,7 @@ def find_loader(fullname):
return importlib.find_loader(fullname, path)
except (ImportError, AttributeError, TypeError, ValueError) as ex:
# This hack fixes an impedance mismatch between pkgutil and
- # importlib, where the latter throws other errors for cases where
+ # importlib, where the latter raises other errors for cases where
# pkgutil previously threw ImportError
msg = "Error while finding loader for {!r} ({}: {})"
raise ImportError(msg.format(fullname, type(ex), ex)) from ex
diff --git a/Lib/tempfile.py b/Lib/tempfile.py
index 39ebf5a..47c60f4 100644
--- a/Lib/tempfile.py
+++ b/Lib/tempfile.py
@@ -621,7 +621,7 @@ class TemporaryDirectory(object):
def __init__(self, suffix="", prefix=template, dir=None):
self._closed = False
- self.name = None # Handle mkdtemp throwing an exception
+ self.name = None # Handle mkdtemp raising an exception
self.name = mkdtemp(suffix, prefix, dir)
def __repr__(self):
diff --git a/Lib/test/test_codeop.py b/Lib/test/test_codeop.py
index d096293..b65423b 100644
--- a/Lib/test/test_codeop.py
+++ b/Lib/test/test_codeop.py
@@ -50,7 +50,7 @@ class CodeopTests(unittest.TestCase):
'''succeed iff str is the start of an invalid piece of code'''
try:
compile_command(str,symbol=symbol)
- self.fail("No exception thrown for invalid code")
+ self.fail("No exception raised for invalid code")
except SyntaxError:
self.assertTrue(is_syntax)
except OverflowError:
diff --git a/Lib/test/test_docxmlrpc.py b/Lib/test/test_docxmlrpc.py
index 60a69dd..d6ca458 100644
--- a/Lib/test/test_docxmlrpc.py
+++ b/Lib/test/test_docxmlrpc.py
@@ -100,7 +100,7 @@ class DocXMLRPCHTTPGETServer(unittest.TestCase):
self.assertEqual(response.status, 200)
self.assertEqual(response.getheader("Content-type"), "text/html")
- # Server throws an exception if we don't start to read the data
+ # Server raises an exception if we don't start to read the data
response.read()
def test_invalid_get_response(self):
diff --git a/Lib/test/test_imaplib.py b/Lib/test/test_imaplib.py
index 512bba9..06776de 100644
--- a/Lib/test/test_imaplib.py
+++ b/Lib/test/test_imaplib.py
@@ -115,7 +115,7 @@ class SimpleIMAPHandler(socketserver.StreamRequestHandler):
return
line += part
except IOError:
- # ..but SSLSockets throw exceptions.
+ # ..but SSLSockets raise exceptions.
return
if line.endswith(b'\r\n'):
break
diff --git a/Lib/test/test_minidom.py b/Lib/test/test_minidom.py
index 0427ba3..5867b2d 100644
--- a/Lib/test/test_minidom.py
+++ b/Lib/test/test_minidom.py
@@ -1073,7 +1073,7 @@ class MinidomTest(unittest.TestCase):
'<?xml version="1.0" encoding="utf-16"?>'
'<foo>\u20ac</foo>'.encode('utf-16'))
- # Verify that character decoding errors throw exceptions instead
+ # Verify that character decoding errors raise exceptions instead
# of crashing
self.assertRaises(UnicodeDecodeError, parseString,
b'<fran\xe7ais>Comment \xe7a va ? Tr\xe8s bien ?</fran\xe7ais>')
diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py
index 13f9e3a..4f86ef5 100644
--- a/Lib/test/test_os.py
+++ b/Lib/test/test_os.py
@@ -202,33 +202,33 @@ class StatAttributeTests(unittest.TestCase):
try:
result[200]
- self.fail("No exception thrown")
+ self.fail("No exception raised")
except IndexError:
pass
# Make sure that assignment fails
try:
result.st_mode = 1
- self.fail("No exception thrown")
+ self.fail("No exception raised")
except AttributeError:
pass
try:
result.st_rdev = 1
- self.fail("No exception thrown")
+ self.fail("No exception raised")
except (AttributeError, TypeError):
pass
try:
result.parrot = 1
- self.fail("No exception thrown")
+ self.fail("No exception raised")
except AttributeError:
pass
# Use the stat_result constructor with a too-short tuple.
try:
result2 = os.stat_result((10,))
- self.fail("No exception thrown")
+ self.fail("No exception raised")
except TypeError:
pass
@@ -273,20 +273,20 @@ class StatAttributeTests(unittest.TestCase):
# Make sure that assignment really fails
try:
result.f_bfree = 1
- self.fail("No exception thrown")
+ self.fail("No exception raised")
except AttributeError:
pass
try:
result.parrot = 1
- self.fail("No exception thrown")
+ self.fail("No exception raised")
except AttributeError:
pass
# Use the constructor with a too-short tuple.
try:
result2 = os.statvfs_result((10,))
- self.fail("No exception thrown")
+ self.fail("No exception raised")
except TypeError:
pass
diff --git a/Lib/test/test_posix.py b/Lib/test/test_posix.py
index 4ad7350..f4e8aba 100644
--- a/Lib/test/test_posix.py
+++ b/Lib/test/test_posix.py
@@ -824,7 +824,7 @@ class PosixTester(unittest.TestCase):
posix.rename(support.TESTFN + 'ren', support.TESTFN)
raise
else:
- posix.stat(support.TESTFN) # should not throw exception
+ posix.stat(support.TESTFN) # should not raise exception
finally:
posix.close(f)
@@ -842,7 +842,7 @@ class PosixTester(unittest.TestCase):
def test_unlink_dir_fd(self):
f = posix.open(posix.getcwd(), posix.O_RDONLY)
support.create_empty_file(support.TESTFN + 'del')
- posix.stat(support.TESTFN + 'del') # should not throw exception
+ posix.stat(support.TESTFN + 'del') # should not raise exception
try:
posix.unlink(support.TESTFN + 'del', dir_fd=f)
except:
diff --git a/Lib/test/test_pty.py b/Lib/test/test_pty.py
index ef95268..29297f8 100644
--- a/Lib/test/test_pty.py
+++ b/Lib/test/test_pty.py
@@ -152,7 +152,7 @@ class PtyTest(unittest.TestCase):
# platform-dependent amount of data is written to its fd. On
# Linux 2.6, it's 4000 bytes and the child won't block, but on OS
# X even the small writes in the child above will block it. Also
- # on Linux, the read() will throw an OSError (input/output error)
+ # on Linux, the read() will raise an OSError (input/output error)
# when it tries to read past the end of the buffer but the child's
# already exited, so catch and discard those exceptions. It's not
# worth checking for EIO.
diff --git a/Lib/test/test_sax.py b/Lib/test/test_sax.py
index 8e00889..7bb30cd 100644
--- a/Lib/test/test_sax.py
+++ b/Lib/test/test_sax.py
@@ -389,7 +389,7 @@ class XmlgenTest(unittest.TestCase):
def test_5027_1(self):
# The xml prefix (as in xml:lang below) is reserved and bound by
# definition to http://www.w3.org/XML/1998/namespace. XMLGenerator had
- # a bug whereby a KeyError is thrown because this namespace is missing
+ # a bug whereby a KeyError is raised because this namespace is missing
# from a dictionary.
#
# This test demonstrates the bug by parsing a document.
@@ -415,7 +415,7 @@ class XmlgenTest(unittest.TestCase):
def test_5027_2(self):
# The xml prefix (as in xml:lang below) is reserved and bound by
# definition to http://www.w3.org/XML/1998/namespace. XMLGenerator had
- # a bug whereby a KeyError is thrown because this namespace is missing
+ # a bug whereby a KeyError is raised because this namespace is missing
# from a dictionary.
#
# This test demonstrates the bug by direct manipulation of the
diff --git a/Lib/test/test_signal.py b/Lib/test/test_signal.py
index c04e52b..d2fd84b 100644
--- a/Lib/test/test_signal.py
+++ b/Lib/test/test_signal.py
@@ -104,7 +104,7 @@ class InterProcessSignalTests(unittest.TestCase):
# This wait should be interrupted by the signal's exception.
self.wait(child)
time.sleep(1) # Give the signal time to be delivered.
- self.fail('HandlerBCalled exception not thrown')
+ self.fail('HandlerBCalled exception not raised')
except HandlerBCalled:
self.assertTrue(self.b_called)
self.assertFalse(self.a_called)
@@ -140,7 +140,7 @@ class InterProcessSignalTests(unittest.TestCase):
# test-running process from all the signals. It then
# communicates with that child process over a pipe and
# re-raises information about any exceptions the child
- # throws. The real work happens in self.run_test().
+ # raises. The real work happens in self.run_test().
os_done_r, os_done_w = os.pipe()
with closing(os.fdopen(os_done_r, 'rb')) as done_r, \
closing(os.fdopen(os_done_w, 'wb')) as done_w:
diff --git a/Lib/test/test_socketserver.py b/Lib/test/test_socketserver.py
index 58fc5d03..3dd0d64 100644
--- a/Lib/test/test_socketserver.py
+++ b/Lib/test/test_socketserver.py
@@ -58,7 +58,7 @@ if HAVE_UNIX_SOCKETS:
def simple_subprocess(testcase):
pid = os.fork()
if pid == 0:
- # Don't throw an exception; it would be caught by the test harness.
+ # Don't raise an exception; it would be caught by the test harness.
os._exit(72)
yield None
pid2, status = os.waitpid(pid, 0)
diff --git a/Lib/test/test_sys_settrace.py b/Lib/test/test_sys_settrace.py
index fdf958c..63ae1b7 100644
--- a/Lib/test/test_sys_settrace.py
+++ b/Lib/test/test_sys_settrace.py
@@ -422,7 +422,7 @@ class RaisingTraceFuncTestCase(unittest.TestCase):
except ValueError:
pass
else:
- self.fail("exception not thrown!")
+ self.fail("exception not raised!")
except RuntimeError:
self.fail("recursion counter not reset")
diff --git a/Lib/test/test_time.py b/Lib/test/test_time.py
index 63e1453..da0f555 100644
--- a/Lib/test/test_time.py
+++ b/Lib/test/test_time.py
@@ -175,7 +175,7 @@ class TimeTestCase(unittest.TestCase):
def test_strptime(self):
# Should be able to go round-trip from strftime to strptime without
- # throwing an exception.
+ # raising an exception.
tt = time.gmtime(self.t)
for directive in ('a', 'A', 'b', 'B', 'c', 'd', 'H', 'I',
'j', 'm', 'M', 'p', 'S',
diff --git a/Lib/test/test_uu.py b/Lib/test/test_uu.py
index d6875c5..cbf6724 100644
--- a/Lib/test/test_uu.py
+++ b/Lib/test/test_uu.py
@@ -80,7 +80,7 @@ class UUTest(unittest.TestCase):
out = io.BytesIO()
try:
uu.decode(inp, out)
- self.fail("No exception thrown")
+ self.fail("No exception raised")
except uu.Error as e:
self.assertEqual(str(e), "Truncated input file")
@@ -89,7 +89,7 @@ class UUTest(unittest.TestCase):
out = io.BytesIO()
try:
uu.decode(inp, out)
- self.fail("No exception thrown")
+ self.fail("No exception raised")
except uu.Error as e:
self.assertEqual(str(e), "No valid begin line found in input file")
diff --git a/Lib/test/test_winreg.py b/Lib/test/test_winreg.py
index 406c5a2..1100737 100644
--- a/Lib/test/test_winreg.py
+++ b/Lib/test/test_winreg.py
@@ -245,7 +245,7 @@ class LocalWinregTests(BaseWinregTests):
def test_changing_value(self):
# Issue2810: A race condition in 2.6 and 3.1 may cause
- # EnumValue or QueryValue to throw "WindowsError: More data is
+ # EnumValue or QueryValue to raise "WindowsError: More data is
# available"
done = False
@@ -291,7 +291,7 @@ class LocalWinregTests(BaseWinregTests):
def test_dynamic_key(self):
# Issue2810, when the value is dynamically generated, these
- # throw "WindowsError: More data is available" in 2.6 and 3.1
+ # raise "WindowsError: More data is available" in 2.6 and 3.1
try:
EnumValue(HKEY_PERFORMANCE_DATA, 0)
except OSError as e:
diff --git a/Lib/test/test_zipfile.py b/Lib/test/test_zipfile.py
index 2e52c68..ac6983f 100644
--- a/Lib/test/test_zipfile.py
+++ b/Lib/test/test_zipfile.py
@@ -1024,7 +1024,7 @@ class OtherTests(unittest.TestCase):
with zipfile.ZipFile(data, mode="w") as zipf:
zipf.writestr("foo.txt", "O, for a Muse of Fire!")
- # This is correct; calling .read on a closed ZipFile should throw
+ # This is correct; calling .read on a closed ZipFile should raise
# a RuntimeError, and so should calling .testzip. An earlier
# version of .testzip would swallow this exception (and any other)
# and report that the first file in the archive was corrupt.
diff --git a/Lib/tkinter/__init__.py b/Lib/tkinter/__init__.py
index 255f5b9..0addc18 100644
--- a/Lib/tkinter/__init__.py
+++ b/Lib/tkinter/__init__.py
@@ -149,7 +149,7 @@ def _tkerror(err):
pass
def _exit(code=0):
- """Internal function. Calling it will throw the exception SystemExit."""
+ """Internal function. Calling it will raise the exception SystemExit."""
try:
code = int(code)
except ValueError:
diff --git a/Lib/unittest/case.py b/Lib/unittest/case.py
index 2e5cb04..ad1fa84 100644
--- a/Lib/unittest/case.py
+++ b/Lib/unittest/case.py
@@ -542,10 +542,10 @@ class TestCase(object):
return '%s : %s' % (safe_repr(standardMsg), safe_repr(msg))
def assertRaises(self, excClass, callableObj=None, *args, **kwargs):
- """Fail unless an exception of class excClass is thrown
+ """Fail unless an exception of class excClass is raised
by callableObj when invoked with arguments args and keyword
arguments kwargs. If a different type of exception is
- thrown, it will not be caught, and the test case will be
+ raised, it will not be caught, and the test case will be
deemed to have suffered an error, exactly as for an
unexpected exception.
diff --git a/Lib/wsgiref/validate.py b/Lib/wsgiref/validate.py
index 05a485d..49eaa51 100644
--- a/Lib/wsgiref/validate.py
+++ b/Lib/wsgiref/validate.py
@@ -139,9 +139,9 @@ def validator(application):
When applied between a WSGI server and a WSGI application, this
middleware will check for WSGI compliancy on a number of levels.
This middleware does not modify the request or response in any
- way, but will throw an AssertionError if anything seems off
+ way, but will raise an AssertionError if anything seems off
(except for a failure to close the application iterator, which
- will be printed to stderr -- there's no way to throw an exception
+ will be printed to stderr -- there's no way to raise an exception
at that point).
"""
diff --git a/Lib/xml/sax/_exceptions.py b/Lib/xml/sax/_exceptions.py
index fdd614a..a9b2ba3 100644
--- a/Lib/xml/sax/_exceptions.py
+++ b/Lib/xml/sax/_exceptions.py
@@ -12,7 +12,7 @@ class SAXException(Exception):
the application: you can subclass it to provide additional
functionality, or to add localization. Note that although you will
receive a SAXException as the argument to the handlers in the
- ErrorHandler interface, you are not actually required to throw
+ ErrorHandler interface, you are not actually required to raise
the exception; instead, you can simply read the information in
it."""
@@ -50,7 +50,7 @@ class SAXParseException(SAXException):
the original XML document. Note that although the application will
receive a SAXParseException as the argument to the handlers in the
ErrorHandler interface, the application is not actually required
- to throw the exception; instead, it can simply read the
+ to raise the exception; instead, it can simply read the
information in it and take a different action.
Since this exception is a subclass of SAXException, it inherits
@@ -62,7 +62,7 @@ class SAXParseException(SAXException):
self._locator = locator
# We need to cache this stuff at construction time.
- # If this exception is thrown, the objects through which we must
+ # If this exception is raised, the objects through which we must
# traverse to get this information may be deleted by the time
# it gets caught.
self._systemId = self._locator.getSystemId()
diff --git a/Lib/xml/sax/xmlreader.py b/Lib/xml/sax/xmlreader.py
index 5ce30b0..7ef497f 100644
--- a/Lib/xml/sax/xmlreader.py
+++ b/Lib/xml/sax/xmlreader.py
@@ -68,7 +68,7 @@ class XMLReader:
SAX parsers are not required to provide localization for errors
and warnings; if they cannot support the requested locale,
- however, they must throw a SAX exception. Applications may
+ however, they must raise a SAX exception. Applications may
request a locale change in the middle of a parse."""
raise SAXNotSupportedException("Locale support not implemented")
diff --git a/Lib/xmlrpc/client.py b/Lib/xmlrpc/client.py
index a779e66..d7b2db3 100644
--- a/Lib/xmlrpc/client.py
+++ b/Lib/xmlrpc/client.py
@@ -811,7 +811,7 @@ class _MultiCallMethod:
class MultiCallIterator:
"""Iterates over the results of a multicall. Exceptions are
- thrown in response to xmlrpc faults."""
+ raised in response to xmlrpc faults."""
def __init__(self, results):
self.results = results
diff --git a/Modules/_io/_iomodule.c b/Modules/_io/_iomodule.c
index d3a87e7..b5cd176 100644
--- a/Modules/_io/_iomodule.c
+++ b/Modules/_io/_iomodule.c
@@ -60,7 +60,7 @@ PyDoc_STRVAR(module_doc,
"At the top of the I/O hierarchy is the abstract base class IOBase. It\n"
"defines the basic interface to a stream. Note, however, that there is no\n"
"separation between reading and writing to streams; implementations are\n"
-"allowed to throw an IOError if they do not support a given operation.\n"
+"allowed to raise an IOError if they do not support a given operation.\n"
"\n"
"Extending IOBase is RawIOBase which deals simply with the reading and\n"
"writing of raw bytes to a stream. FileIO subclasses RawIOBase to provide\n"
diff --git a/Modules/parsermodule.c b/Modules/parsermodule.c
index b4602f5..fea603e 100644
--- a/Modules/parsermodule.c
+++ b/Modules/parsermodule.c
@@ -696,7 +696,7 @@ parser_tuple2st(PyST_Object *self, PyObject *args, PyObject *kw)
err_string("parse tree does not use a valid start symbol");
}
}
- /* Make sure we throw an exception on all errors. We should never
+ /* Make sure we raise an exception on all errors. We should never
* get this, but we'd do well to be sure something is done.
*/
if (st == NULL && !PyErr_Occurred())
@@ -802,7 +802,7 @@ build_node_children(PyObject *tuple, node *root, int *line_num)
else if (!ISNONTERMINAL(type)) {
/*
* It has to be one or the other; this is an error.
- * Throw an exception.
+ * Raise an exception.
*/
PyObject *err = Py_BuildValue("os", elem, "unknown node type.");
PyErr_SetObject(parser_error, err);
@@ -854,7 +854,7 @@ build_node_tree(PyObject *tuple)
if (ISTERMINAL(num)) {
/*
* The tuple is simple, but it doesn't start with a start symbol.
- * Throw an exception now and be done with it.
+ * Raise an exception now and be done with it.
*/
tuple = Py_BuildValue("os", tuple,
"Illegal syntax-tree; cannot start with terminal symbol.");
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index 3f863a8..cba3691 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -767,7 +767,7 @@ _parse_off_t(PyObject* arg, void* addr)
#if defined _MSC_VER && _MSC_VER >= 1400
/* Microsoft CRT in VS2005 and higher will verify that a filehandle is
- * valid and throw an assertion if it isn't.
+ * valid and raise an assertion if it isn't.
* Normally, an invalid fd is likely to be a C program error and therefore
* an assertion can be useful, but it does contradict the POSIX standard
* which for write(2) states:
diff --git a/Tools/scripts/find_recursionlimit.py b/Tools/scripts/find_recursionlimit.py
index c42de7f..1171146 100755
--- a/Tools/scripts/find_recursionlimit.py
+++ b/Tools/scripts/find_recursionlimit.py
@@ -92,7 +92,7 @@ def test_cpickle(_cache={}):
def test_compiler_recursion():
# The compiler uses a scaling factor to support additional levels
# of recursion. This is a sanity check of that scaling to ensure
- # it still throws RuntimeError even at higher recursion limits
+ # it still raises RuntimeError even at higher recursion limits
compile("()" * (10 * sys.getrecursionlimit()), "<single>", "single")
def check_limit(n, test_func_name):
diff --git a/Tools/scripts/serve.py b/Tools/scripts/serve.py
index 89b3d62..68c25f0 100755
--- a/Tools/scripts/serve.py
+++ b/Tools/scripts/serve.py
@@ -2,7 +2,7 @@
'''
Small wsgiref based web server. Takes a path to serve from and an
optional port number (defaults to 8000), then tries to serve files.
-Mime types are guessed from the file names, 404 errors are thrown
+Mime types are guessed from the file names, 404 errors are raised
if the file is not found. Used for the make serve target in Doc.
'''
import sys