#17341: Include name in re error message about invalid group name.

Patch by Jason Michalski.
This commit is contained in:
R David Murray 2013-04-14 13:00:54 -04:00
parent f2fa5fc794
commit 26dfaac9ac
4 changed files with 18 additions and 2 deletions

View file

@ -600,7 +600,7 @@ def _parse(source, state):
if not name:
raise error("missing group name")
if not name.isidentifier():
raise error("bad character in group name")
raise error("bad character in group name %r" % name)
elif sourcematch("="):
# named backreference
name = ""
@ -614,7 +614,8 @@ def _parse(source, state):
if not name:
raise error("missing group name")
if not name.isidentifier():
raise error("bad character in group name")
raise error("bad character in backref group name "
"%r" % name)
gid = state.groupdict.get(name)
if gid is None:
raise error("unknown group name")