mirror of
https://github.com/python/cpython.git
synced 2025-08-31 14:07:50 +00:00
#17341: Include name in re error message about invalid group name.
Patch by Jason Michalski.
This commit is contained in:
parent
f2fa5fc794
commit
26dfaac9ac
4 changed files with 18 additions and 2 deletions
|
@ -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")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue