diff options
Diffstat (limited to 'Lib/sre_parse.py')
-rw-r--r-- | Lib/sre_parse.py | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/Lib/sre_parse.py b/Lib/sre_parse.py index b9a1852823..063d1b7fda 100644 --- a/Lib/sre_parse.py +++ b/Lib/sre_parse.py @@ -880,14 +880,12 @@ def parse_template(source, pattern): def expand_template(template, match): g = match.group - sep = match.string[:0] + empty = match.string[:0] groups, literals = template literals = literals[:] try: for index, group in groups: - literals[index] = s = g(group) - if s is None: - raise error("unmatched group") + literals[index] = g(group) or empty except IndexError: raise error("invalid group reference") - return sep.join(literals) + return empty.join(literals) |