summaryrefslogtreecommitdiffstats
path: root/Lib/email
diff options
context:
space:
mode:
authorAndrew Svetlov <andrew.svetlov@gmail.com>2012-12-18 19:26:36 (GMT)
committerAndrew Svetlov <andrew.svetlov@gmail.com>2012-12-18 19:26:36 (GMT)
commit5b89840d9cf11014a4b865d79497649f74bf2866 (patch)
treed3ff6d2bce57a9f4b89356c0519b2d6eb9cda7ad /Lib/email
parente2303f8970ee6f30d3781ad31f76530d135a57b5 (diff)
parent737fb89dd15e4db6ef30d25963e774ae09cc49dc (diff)
downloadcpython-5b89840d9cf11014a4b865d79497649f74bf2866.zip
cpython-5b89840d9cf11014a4b865d79497649f74bf2866.tar.gz
cpython-5b89840d9cf11014a4b865d79497649f74bf2866.tar.bz2
Issue #16714: use 'raise' exceptions, don't 'throw'.
Patch by Serhiy Storchaka.
Diffstat (limited to 'Lib/email')
-rw-r--r--Lib/email/feedparser.py4
-rw-r--r--Lib/email/header.py2
-rw-r--r--Lib/email/utils.py2
3 files changed, 4 insertions, 4 deletions
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: