]> granicus.if.org Git - python/commitdiff
Issue #26475: Fixed debugging output for regular expressions with the (?x) flag.
authorSerhiy Storchaka <storchaka@gmail.com>
Sun, 6 Mar 2016 07:15:47 +0000 (09:15 +0200)
committerSerhiy Storchaka <storchaka@gmail.com>
Sun, 6 Mar 2016 07:15:47 +0000 (09:15 +0200)
Lib/sre_parse.py
Misc/NEWS

index c29cc1685cb663626fcccbae3c56b15bdf90b02c..75f488b5475093e810be5c871ddd6c373f12b26f 100644 (file)
@@ -721,14 +721,14 @@ def parse(str, flags=0, pattern=None):
     elif tail:
         raise error, "bogus characters at end of regular expression"
 
-    if flags & SRE_FLAG_DEBUG:
-        p.dump()
-
     if not (flags & SRE_FLAG_VERBOSE) and p.pattern.flags & SRE_FLAG_VERBOSE:
         # the VERBOSE flag was switched on inside the pattern.  to be
         # on the safe side, we'll parse the whole thing again...
         return parse(str, p.pattern.flags)
 
+    if flags & SRE_FLAG_DEBUG:
+        p.dump()
+
     return p
 
 def parse_template(source, pattern):
index 51220c3275f52fda8b806cb975eb4bb839d512c9..5308a1239a36106824684a488f714ac0a51ed75b 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -55,6 +55,9 @@ Core and Builtins
 Library
 -------
 
+- Issue #26475: Fixed debugging output for regular expressions with the (?x)
+  flag.
+
 - Issue #26385: Remove the file if the internal fdopen() call in
   NamedTemporaryFile() fails.  Based on patch by Silent Ghost.