diff options
author | R David Murray <rdmurray@bitdance.com> | 2013-04-14 17:00:54 (GMT) |
---|---|---|
committer | R David Murray <rdmurray@bitdance.com> | 2013-04-14 17:00:54 (GMT) |
commit | 26dfaac9ac0cf9a34006ab52a0e0cc4e39b772fa (patch) | |
tree | 36227d0c87ddb055c1b4b2f13020b0b7b19652e4 /Lib/sre_parse.py | |
parent | f2fa5fc794834da5282218458bec3fa16da6671f (diff) | |
download | cpython-26dfaac9ac0cf9a34006ab52a0e0cc4e39b772fa.zip cpython-26dfaac9ac0cf9a34006ab52a0e0cc4e39b772fa.tar.gz cpython-26dfaac9ac0cf9a34006ab52a0e0cc4e39b772fa.tar.bz2 |
#17341: Include name in re error message about invalid group name.
Patch by Jason Michalski.
Diffstat (limited to 'Lib/sre_parse.py')
-rw-r--r-- | Lib/sre_parse.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Lib/sre_parse.py b/Lib/sre_parse.py index 2ebce89..9e0501f 100644 --- a/Lib/sre_parse.py +++ b/Lib/sre_parse.py @@ -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") |