changeset: 100420:b8928725e8cc branch: 2.7 parent: 100418:ea5d01c7997e user: Serhiy Storchaka date: Sun Mar 06 09:15:47 2016 +0200 files: Lib/sre_parse.py Misc/NEWS description: Issue #26475: Fixed debugging output for regular expressions with the (?x) flag. diff -r ea5d01c7997e -r b8928725e8cc Lib/sre_parse.py --- a/Lib/sre_parse.py Sun Mar 06 09:05:47 2016 +0200 +++ b/Lib/sre_parse.py Sun Mar 06 09:15:47 2016 +0200 @@ -721,14 +721,14 @@ elif tail: raise error, "bogus characters at end of regular expression" - 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 -r ea5d01c7997e -r b8928725e8cc Misc/NEWS --- a/Misc/NEWS Sun Mar 06 09:05:47 2016 +0200 +++ b/Misc/NEWS Sun Mar 06 09:15:47 2016 +0200 @@ -55,6 +55,9 @@ Library ------- +- Issue #26475: Fixed debugging output for regular expressions with the (?x) + flag. + - Issue #26385: Remove the file if the internal fdopen() call in NamedTemporaryFile() fails. Based on patch by Silent Ghost.