]> granicus.if.org Git - python/commitdiff
SF bug #476912: flag repeated use of the same groupname as
authorFredrik Lundh <fredrik@pythonware.com>
Fri, 2 Nov 2001 13:59:51 +0000 (13:59 +0000)
committerFredrik Lundh <fredrik@pythonware.com>
Fri, 2 Nov 2001 13:59:51 +0000 (13:59 +0000)
the error it really is (and always has been)

Lib/sre_parse.py

index 7d9b8899bc6406aa85c983ac7fa3542bebd52a08..4596f3b458ca7ac2f708dddc163ae4abb60ccfb7 100644 (file)
@@ -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