diff options
Diffstat (limited to 'Lib/sre_parse.py')
-rw-r--r-- | Lib/sre_parse.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Lib/sre_parse.py b/Lib/sre_parse.py index f4741c9bd9..fcf5bcc9fd 100644 --- a/Lib/sre_parse.py +++ b/Lib/sre_parse.py @@ -593,6 +593,11 @@ def parse(str, flags=0, pattern=None): # 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) + return p def parse_template(source, pattern): |