summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFredrik Lundh <fredrik@pythonware.com>2001-11-02 13:59:51 (GMT)
committerFredrik Lundh <fredrik@pythonware.com>2001-11-02 13:59:51 (GMT)
commit8a0232d84fcc3317e31f7c4cad5c1d34a3c16f10 (patch)
treedc210a5ef1972f4ae1f90c8582ce86f2b61d34ec
parent4e8ab5db38c84e981f1e4cd11fd375bf7469341e (diff)
downloadcpython-8a0232d84fcc3317e31f7c4cad5c1d34a3c16f10.zip
cpython-8a0232d84fcc3317e31f7c4cad5c1d34a3c16f10.tar.gz
cpython-8a0232d84fcc3317e31f7c4cad5c1d34a3c16f10.tar.bz2
SF bug #476912: flag repeated use of the same groupname as
the error it really is (and always has been)
-rw-r--r--Lib/sre_parse.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/Lib/sre_parse.py b/Lib/sre_parse.py
index 7d9b889..4596f3b 100644
--- a/Lib/sre_parse.py
+++ b/Lib/sre_parse.py
@@ -81,6 +81,8 @@ class Pattern:
gid = self.groups
self.groups = gid + 1
if name:
+ if self.groupdict.has_key(name):
+ raise error, "can only use each group name once"
self.groupdict[name] = gid
self.open.append(gid)
return gid
@@ -189,7 +191,7 @@ class Tokenizer:
try:
c = self.string[self.index + 1]
except IndexError:
- raise error, "bogus escape"
+ raise error, "bogus escape (end of line)"
char = char + c
self.index = self.index + len(char)
self.next = char