Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a01a144

Browse files
Issue #26475: Fixed debugging output for regular expressions with the (?x) flag.
1 parent be70002 commit a01a144

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

Lib/sre_parse.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -833,14 +833,14 @@ def parse(str, flags=0, pattern=None):
833833
assert source.next == ")"
834834
raise source.error("unbalanced parenthesis")
835835

836-
if flags & SRE_FLAG_DEBUG:
837-
p.dump()
838-
839836
if not (flags & SRE_FLAG_VERBOSE) and p.pattern.flags & SRE_FLAG_VERBOSE:
840837
# the VERBOSE flag was switched on inside the pattern. to be
841838
# on the safe side, we'll parse the whole thing again...
842839
return parse(str, p.pattern.flags)
843840

841+
if flags & SRE_FLAG_DEBUG:
842+
p.dump()
843+
844844
return p
845845

846846
def parse_template(source, pattern):

Misc/NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,9 @@ Core and Builtins
9191
Library
9292
-------
9393

94+
- Issue #26475: Fixed debugging output for regular expressions with the (?x)
95+
flag.
96+
9497
- Issue #26457: Fixed the subnets() methods in IP network classes for the case
9598
when resulting prefix length is equal to maximal prefix length.
9699
Based on patch by Xiang Zhang.

0 commit comments

Comments
 (0)