diff options
author | Fredrik Lundh <fredrik@pythonware.com> | 2001-11-02 13:59:51 +0000 |
---|---|---|
committer | Fredrik Lundh <fredrik@pythonware.com> | 2001-11-02 13:59:51 +0000 |
commit | 224f2e79a980c0e6e235913ca10a0edd52ea8343 (patch) | |
tree | 38e40644ef3ad27fbc83eeb46b5b8c667ab2b1d5 /Lib/sre_parse.py | |
parent | 8cff3e698470caa364bf588dcdc0e6f2a42b897b (diff) | |
download | cpython-224f2e79a980c0e6e235913ca10a0edd52ea8343.tar.gz |
SF bug #476912: flag repeated use of the same groupname as
the error it really is (and always has been)
Diffstat (limited to 'Lib/sre_parse.py')
-rw-r--r-- | Lib/sre_parse.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Lib/sre_parse.py b/Lib/sre_parse.py index 7d9b8899bc..4596f3b458 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 |