summaryrefslogtreecommitdiffstats
path: root/Lib/http
diff options
context:
space:
mode:
authorR David Murray <rdmurray@bitdance.com>2016-09-08 17:59:53 (GMT)
committerR David Murray <rdmurray@bitdance.com>2016-09-08 17:59:53 (GMT)
commit44b548dda872c0d4f30afd6b44fd74b053a55ad8 (patch)
treeb3c1ff8485bc279000f9db95491ebc69a4385876 /Lib/http
parent513d7478a136e7646075592da2593476299cc8be (diff)
downloadcpython-44b548dda872c0d4f30afd6b44fd74b053a55ad8.zip
cpython-44b548dda872c0d4f30afd6b44fd74b053a55ad8.tar.gz
cpython-44b548dda872c0d4f30afd6b44fd74b053a55ad8.tar.bz2
#27364: fix "incorrect" uses of escape character in the stdlib.
And most of the tools. Patch by Emanual Barry, reviewed by me, Serhiy Storchaka, and Martin Panter.
Diffstat (limited to 'Lib/http')
-rw-r--r--Lib/http/client.py2
-rw-r--r--Lib/http/cookiejar.py6
-rw-r--r--Lib/http/cookies.py2
3 files changed, 5 insertions, 5 deletions
diff --git a/Lib/http/client.py b/Lib/http/client.py
index 230bcce..a1c4ab9 100644
--- a/Lib/http/client.py
+++ b/Lib/http/client.py
@@ -1,4 +1,4 @@
-"""HTTP/1.1 client library
+r"""HTTP/1.1 client library
<intro stuff goes here>
<other stuff, too>
diff --git a/Lib/http/cookiejar.py b/Lib/http/cookiejar.py
index 6d4572a..adf956d 100644
--- a/Lib/http/cookiejar.py
+++ b/Lib/http/cookiejar.py
@@ -200,7 +200,7 @@ def _str2time(day, mon, yr, hr, min, sec, tz):
STRICT_DATE_RE = re.compile(
r"^[SMTWF][a-z][a-z], (\d\d) ([JFMASOND][a-z][a-z]) "
- "(\d\d\d\d) (\d\d):(\d\d):(\d\d) GMT$", re.ASCII)
+ r"(\d\d\d\d) (\d\d):(\d\d):(\d\d) GMT$", re.ASCII)
WEEKDAY_RE = re.compile(
r"^(?:Sun|Mon|Tue|Wed|Thu|Fri|Sat)[a-z]*,?\s*", re.I | re.ASCII)
LOOSE_HTTP_DATE_RE = re.compile(
@@ -277,7 +277,7 @@ def http2time(text):
return _str2time(day, mon, yr, hr, min, sec, tz)
ISO_DATE_RE = re.compile(
- """^
+ r"""^
(\d{4}) # year
[-\/]?
(\d\d?) # numerical month
@@ -411,7 +411,7 @@ def split_header_words(header_values):
pairs = []
else:
# skip junk
- non_junk, nr_junk_chars = re.subn("^[=\s;]*", "", text)
+ non_junk, nr_junk_chars = re.subn(r"^[=\s;]*", "", text)
assert nr_junk_chars > 0, (
"split_header_words bug: '%s', '%s', %s" %
(orig_text, text, pairs))
diff --git a/Lib/http/cookies.py b/Lib/http/cookies.py
index a73fe38..f078da5 100644
--- a/Lib/http/cookies.py
+++ b/Lib/http/cookies.py
@@ -456,7 +456,7 @@ class Morsel(dict):
#
_LegalKeyChars = r"\w\d!#%&'~_`><@,:/\$\*\+\-\.\^\|\)\(\?\}\{\="
-_LegalValueChars = _LegalKeyChars + '\[\]'
+_LegalValueChars = _LegalKeyChars + r'\[\]'
_CookiePattern = re.compile(r"""
(?x) # This is a verbose pattern
\s* # Optional whitespace at start of cookie