diff options
| author | Raymond Hettinger <python@rcn.com> | 2014-06-23 02:47:55 (GMT) |
|---|---|---|
| committer | Raymond Hettinger <python@rcn.com> | 2014-06-23 02:47:55 (GMT) |
| commit | ef85df168ac4481d54ece0e7ba84ff7d48647e20 (patch) | |
| tree | a092d27a062d0a54e5223a9113da0648c103d0f6 | |
| parent | 7534539536c0f512b57430177cc2e6fea5b92be4 (diff) | |
| parent | 1c99bc84bd6bdc4fa2526424bb0db99a11facf48 (diff) | |
| download | cpython-ef85df168ac4481d54ece0e7ba84ff7d48647e20.zip cpython-ef85df168ac4481d54ece0e7ba84ff7d48647e20.tar.gz cpython-ef85df168ac4481d54ece0e7ba84ff7d48647e20.tar.bz2 | |
merge
| -rw-r--r-- | Lib/sre_parse.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/Lib/sre_parse.py b/Lib/sre_parse.py index 399e7b7..3209ce0 100644 --- a/Lib/sre_parse.py +++ b/Lib/sre_parse.py @@ -616,7 +616,8 @@ def _parse(source, state): "%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 @@ def _parse(source, state): 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 @@ def parse_template(source, pattern): 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: |
