diff -r 6300531dde60 Lib/sre_parse.py --- a/Lib/sre_parse.py Tue Mar 01 23:34:47 2016 +0100 +++ b/Lib/sre_parse.py Thu Mar 03 10:17:30 2016 +0200 @@ -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):