summaryrefslogtreecommitdiffstats
path: root/Lib/sre_parse.py
diff options
context:
space:
mode:
authorR David Murray <rdmurray@bitdance.com>2013-04-14 17:08:50 (GMT)
committerR David Murray <rdmurray@bitdance.com>2013-04-14 17:08:50 (GMT)
commit6077339270edd5786f7e18e0d71e88a33224cc82 (patch)
tree172b14b37ad75d38e447b2994dc163989244cb22 /Lib/sre_parse.py
parentff99e414c97196e431fddd3f3ad944d744e5f7ac (diff)
downloadcpython-6077339270edd5786f7e18e0d71e88a33224cc82.zip
cpython-6077339270edd5786f7e18e0d71e88a33224cc82.tar.gz
cpython-6077339270edd5786f7e18e0d71e88a33224cc82.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.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/Lib/sre_parse.py b/Lib/sre_parse.py
index a0cf344..75f8c96 100644
--- a/Lib/sre_parse.py
+++ b/Lib/sre_parse.py
@@ -549,7 +549,8 @@ def _parse(source, state):
if not name:
raise error("missing group name")
if not isname(name):
- raise error, "bad character in group name"
+ raise error("bad character in group name %r" %
+ name)
elif sourcematch("="):
# named backreference
name = ""
@@ -563,7 +564,8 @@ def _parse(source, state):
if not name:
raise error("missing group name")
if not isname(name):
- 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"