[Python-checkins] cpython (3.4): Issue #8343: Named group error msgs did not show the group name.
raymond.hettinger
python-checkins at python.org
Mon Jun 23 04:48:02 CEST 2014
http://hg.python.org/cpython/rev/404dcd29b0a6
changeset: 91343:404dcd29b0a6
branch: 3.4
parent: 91338:db7887f3e6a2
user: Raymond Hettinger <python at rcn.com>
date: Sun Jun 22 19:47:22 2014 -0700
summary:
Issue #8343: Named group error msgs did not show the group name.
files:
Lib/sre_parse.py | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/Lib/sre_parse.py b/Lib/sre_parse.py
--- a/Lib/sre_parse.py
+++ b/Lib/sre_parse.py
@@ -616,7 +616,8 @@
"%r" % name)
gid = state.groupdict.get(name)
if gid is None:
- raise error("unknown group name")
+ msg = "unknown group name: {0!r}".format(name)
+ raise error(msg)
subpatternappend((GROUPREF, gid))
continue
else:
@@ -669,7 +670,8 @@
if condname.isidentifier():
condgroup = state.groupdict.get(condname)
if condgroup is None:
- raise error("unknown group name")
+ msg = "unknown group name: {0!r}".format(condname)
+ raise error(msg)
else:
try:
condgroup = int(condname)
@@ -806,7 +808,8 @@
try:
index = pattern.groupindex[name]
except KeyError:
- raise IndexError("unknown group name")
+ msg = "unknown group name: {0!r}".format(name)
+ raise IndexError(msg)
addgroup(index)
elif c == "0":
if s.next in OCTDIGITS:
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list