Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8a0232d

Browse files
author
Fredrik Lundh
committed
SF bug #476912: flag repeated use of the same groupname as
the error it really is (and always has been)
1 parent 4e8ab5d commit 8a0232d

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

Lib/sre_parse.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ def opengroup(self, name=None):
8181
gid = self.groups
8282
self.groups = gid + 1
8383
if name:
84+
if self.groupdict.has_key(name):
85+
raise error, "can only use each group name once"
8486
self.groupdict[name] = gid
8587
self.open.append(gid)
8688
return gid
@@ -189,7 +191,7 @@ def __next(self):
189191
try:
190192
c = self.string[self.index + 1]
191193
except IndexError:
192-
raise error, "bogus escape"
194+
raise error, "bogus escape (end of line)"
193195
char = char + c
194196
self.index = self.index + len(char)
195197
self.next = char

0 commit comments

Comments
 (0)