aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorR David Murray <rdmurray@bitdance.com>2016-09-08 13:59:53 -0400
committerR David Murray <rdmurray@bitdance.com>2016-09-08 13:59:53 -0400
commit44b548dda872c0d4f30afd6b44fd74b053a55ad8 (patch)
treeb3c1ff8485bc279000f9db95491ebc69a4385876 /Lib/doctest.py
parentFix mismatched if blocks in posixmodule.c. (diff)
downloadcpython-44b548dda872c0d4f30afd6b44fd74b053a55ad8.tar.gz
cpython-44b548dda872c0d4f30afd6b44fd74b053a55ad8.tar.bz2
cpython-44b548dda872c0d4f30afd6b44fd74b053a55ad8.zip
#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/doctest.py')
-rw-r--r--Lib/doctest.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/Lib/doctest.py b/Lib/doctest.py
index 5630220c5f5..0b78544d8d0 100644
--- a/Lib/doctest.py
+++ b/Lib/doctest.py
@@ -765,7 +765,7 @@ class DocTestParser:
# This regular expression finds the indentation of every non-blank
# line in a string.
- _INDENT_RE = re.compile('^([ ]*)(?=\S)', re.MULTILINE)
+ _INDENT_RE = re.compile(r'^([ ]*)(?=\S)', re.MULTILINE)
def _min_indent(self, s):
"Return the minimum indentation of any non-blank line in `s`"
@@ -1106,7 +1106,7 @@ class DocTestFinder:
if lineno is not None:
if source_lines is None:
return lineno+1
- pat = re.compile('(^|.*:)\s*\w*("|\')')
+ pat = re.compile(r'(^|.*:)\s*\w*("|\')')
for lineno in range(lineno, len(source_lines)):
if pat.match(source_lines[lineno]):
return lineno
@@ -1608,11 +1608,11 @@ class OutputChecker:
# blank line, unless the DONT_ACCEPT_BLANKLINE flag is used.
if not (optionflags & DONT_ACCEPT_BLANKLINE):
# Replace <BLANKLINE> in want with a blank line.
- want = re.sub('(?m)^%s\s*?$' % re.escape(BLANKLINE_MARKER),
+ want = re.sub(r'(?m)^%s\s*?$' % re.escape(BLANKLINE_MARKER),
'', want)
# If a line in got contains only spaces, then remove the
# spaces.
- got = re.sub('(?m)^\s*?$', '', got)
+ got = re.sub(r'(?m)^\s*?$', '', got)
if got == want:
return True