summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorINADA Naoki <methane@users.noreply.github.com>2017-10-04 03:47:38 (GMT)
committerGitHub <noreply@github.com>2017-10-04 03:47:38 (GMT)
commitbf477a99e0c85258e6573f4ee9eda68fa1f98a31 (patch)
tree89ada028feed7b97887303b872c7ddd5d1b8e9c4 /Lib
parente2d0dd2cf98cfa558435693b9f066edd7cf7d71a (diff)
downloadcpython-bf477a99e0c85258e6573f4ee9eda68fa1f98a31.zip
cpython-bf477a99e0c85258e6573f4ee9eda68fa1f98a31.tar.gz
cpython-bf477a99e0c85258e6573f4ee9eda68fa1f98a31.tar.bz2
bpo-31677: email: Remove re.IGNORECASE flag (GH-3868)
While there is not real bug in this case, using re.IGNORECASE without re.ASCII leads unexpected behavior. Instead of adding re.ASCII, this commit removes re.IGNORECASE flag because it's easier and simpler. This commit removes dead copy of the pattern in email.util module too. While the pattern is same, it is compiled separately because it had different flags.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/email/header.py4
-rw-r--r--Lib/email/utils.py12
2 files changed, 2 insertions, 14 deletions
diff --git a/Lib/email/header.py b/Lib/email/header.py
index c7b2dd9..7b30a03 100644
--- a/Lib/email/header.py
+++ b/Lib/email/header.py
@@ -36,11 +36,11 @@ ecre = re.compile(r'''
=\? # literal =?
(?P<charset>[^?]*?) # non-greedy up to the next ? is the charset
\? # literal ?
- (?P<encoding>[qb]) # either a "q" or a "b", case insensitive
+ (?P<encoding>[qQbB]) # either a "q" or a "b", case insensitive
\? # literal ?
(?P<encoded>.*?) # non-greedy up to the next ?= is the encoded string
\?= # literal ?=
- ''', re.VERBOSE | re.IGNORECASE | re.MULTILINE)
+ ''', re.VERBOSE | re.MULTILINE)
# Field name regexp, including trailing colon, but not separating whitespace,
# according to RFC 2822. Character range is from tilde to exclamation mark.
diff --git a/Lib/email/utils.py b/Lib/email/utils.py
index 39c2240..858f620 100644
--- a/Lib/email/utils.py
+++ b/Lib/email/utils.py
@@ -114,18 +114,6 @@ def getaddresses(fieldvalues):
return a.addresslist
-
-ecre = re.compile(r'''
- =\? # literal =?
- (?P<charset>[^?]*?) # non-greedy up to the next ? is the charset
- \? # literal ?
- (?P<encoding>[qb]) # either a "q" or a "b", case insensitive
- \? # literal ?
- (?P<atom>.*?) # non-greedy up to the next ?= is the atom
- \?= # literal ?=
- ''', re.VERBOSE | re.IGNORECASE)
-
-
def _format_timetuple_and_zone(timetuple, zone):
return '%s, %02d %s %04d %02d:%02d:%02d %s' % (
['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'][timetuple[6]],