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 f6a88517dfc3b5a4e34501d9175c0a48bcff2478..4ff50d1006a607356349b75f738230cdef58415e 100644 (file)
@@ -833,14 +833,14 @@ def parse(str, flags=0, pattern=None):
         assert source.next == ")"
         raise source.error("unbalanced parenthesis")
 
-    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 8044942d1ac48a84ef891e8bcec1f05b429f632c..fd9a4d6cdb1263c45f0329649dcfa234b1544aeb 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -91,6 +91,9 @@ Core and Builtins
 Library
 -------
 
+- Issue #26475: Fixed debugging output for regular expressions with the (?x)
+  flag.
+
 - Issue #26457: Fixed the subnets() methods in IP network classes for the case
   when resulting prefix length is equal to maximal prefix length.
   Based on patch by Xiang Zhang.