[Python-checkins] cpython (3.5): Issue #26475: Fixed debugging output for regular expressions with the (?x) flag.

serhiy.storchaka python-checkins at python.org
Sun Mar 6 02:18:05 EST 2016


https://hg.python.org/cpython/rev/910d0256601f
changeset:   100419:910d0256601f
branch:      3.5
parent:      100411:57d6b257cf55
user:        Serhiy Storchaka <storchaka at gmail.com>
date:        Sun Mar 06 09:15:47 2016 +0200
summary:
  Issue #26475: Fixed debugging output for regular expressions with the (?x) flag.

files:
  Lib/sre_parse.py |  6 +++---
  Misc/NEWS        |  3 +++
  2 files changed, 6 insertions(+), 3 deletions(-)


diff --git a/Lib/sre_parse.py b/Lib/sre_parse.py
--- a/Lib/sre_parse.py
+++ b/Lib/sre_parse.py
@@ -833,14 +833,14 @@
         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):
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -91,6 +91,9 @@
 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.

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list