cpython: e47f6883dedf (original) (raw)

Mercurial > cpython

changeset 88942:e47f6883dedf 2.7

Issue #20426: When passing the re.DEBUG flag, re.compile() displays the debug output every time it is called, regardless of the compilation cache. [#20426]

Antoine Pitrou solipsis@pitrou.net
date Mon, 03 Feb 2014 20:59:59 +0100
parents 129eb818d9b2
children aed29f86bfdc
files Lib/re.py Lib/test/test_re.py Misc/NEWS
diffstat 3 files changed, 27 insertions(+), 7 deletions(-)[+] [-] Lib/re.py 17 Lib/test/test_re.py 14 Misc/NEWS 3

line wrap: on

line diff

--- a/Lib/re.py +++ b/Lib/re.py @@ -225,11 +225,13 @@ def escape(pattern): def _compile(*key): # internal: compile pattern

@@ -240,9 +242,10 @@ def _compile(*key): p = sre_compile.compile(pattern, flags) except error, v: raise error, v # invalid expression

--- a/Lib/test/test_re.py +++ b/Lib/test/test_re.py @@ -1,5 +1,6 @@ from test.test_support import verbose, run_unittest, import_module from test.test_support import precisionbigmemtest, _2G, cpython_only +from test.test_support import captured_stdout import re from re import Scanner import sre_constants @@ -920,6 +921,19 @@ class ReTests(unittest.TestCase): self.assertEqual(m.group(1), "") self.assertEqual(m.group(2), "y")

+ + def run_re_tests(): from test.re_tests import tests, SUCCEED, FAIL, SYNTAX_ERROR if verbose:

--- a/Misc/NEWS +++ b/Misc/NEWS @@ -38,6 +38,9 @@ Core and Builtins Library ------- +- Issue #20426: When passing the re.DEBUG flag, re.compile() displays the