cpython: a8bcfa290e68 (original) (raw)

Mercurial > cpython

changeset 88941:a8bcfa290e68

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 21:01:35 +0100
parents 6007e81f5867(current diff)a7b180d5df5f(diff)
children a5a622309a0b
files Lib/re.py Lib/test/test_re.py Misc/NEWS
diffstat 3 files changed, 26 insertions(+), 8 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 @@ -272,10 +272,12 @@ def escape(pattern): _MAXCACHE = 512 def _compile(pattern, flags): # internal: compile pattern

@@ -284,9 +286,10 @@ def _compile(pattern, flags): if not sre_compile.isstring(pattern): raise TypeError("first argument must be string or compiled pattern") p = sre_compile.compile(pattern, flags)

--- a/Lib/test/test_re.py +++ b/Lib/test/test_re.py @@ -1,5 +1,5 @@ from test.support import verbose, run_unittest, gc_collect, bigmemtest, _2G, [](#l2.4)

import io import re from re import Scanner @@ -1193,6 +1193,18 @@ class ReTests(unittest.TestCase): self.assertEqual(m.group(1), "") self.assertEqual(m.group(2), "y")

+ class PatternReprTests(unittest.TestCase): def check(self, pattern, expected):

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