diff options
author | R David Murray <rdmurray@bitdance.com> | 2016-09-08 13:59:53 -0400 |
---|---|---|
committer | R David Murray <rdmurray@bitdance.com> | 2016-09-08 13:59:53 -0400 |
commit | 44b548dda872c0d4f30afd6b44fd74b053a55ad8 (patch) | |
tree | b3c1ff8485bc279000f9db95491ebc69a4385876 /Lib/doctest.py | |
parent | Fix mismatched if blocks in posixmodule.c. (diff) | |
download | cpython-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.py | 8 |
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 |