diff options
author | Fredrik Lundh <fredrik@pythonware.com> | 2001-02-18 21:04:48 (GMT) |
---|---|---|
committer | Fredrik Lundh <fredrik@pythonware.com> | 2001-02-18 21:04:48 (GMT) |
commit | c0c7ee3a6536bbea2b9632a4cc9f6cac2a4bd9b6 (patch) | |
tree | 1aedbd30e101240d849686fcc4106d686ae983f2 /Lib/sre_parse.py | |
parent | 8ac3627b91979a069d84fb9e8500eab0a99ce762 (diff) | |
download | cpython-c0c7ee3a6536bbea2b9632a4cc9f6cac2a4bd9b6.zip cpython-c0c7ee3a6536bbea2b9632a4cc9f6cac2a4bd9b6.tar.gz cpython-c0c7ee3a6536bbea2b9632a4cc9f6cac2a4bd9b6.tar.bz2 |
detect attempts to repeat anchors (fixes bug #130748)
Diffstat (limited to 'Lib/sre_parse.py')
-rw-r--r-- | Lib/sre_parse.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Lib/sre_parse.py b/Lib/sre_parse.py index 36036b6..3840365 100644 --- a/Lib/sre_parse.py +++ b/Lib/sre_parse.py @@ -446,6 +446,7 @@ def _parse(source, state): min, max = 0, 1 elif this == "*": min, max = 0, MAXREPEAT + elif this == "+": min, max = 1, MAXREPEAT elif this == "{": @@ -475,6 +476,8 @@ def _parse(source, state): if subpattern: item = subpattern[-1:] else: + item = None + if not item or (len(item) == 1 and item[0][0] == AT): raise error, "nothing to repeat" if item[0][0] in (MIN_REPEAT, MAX_REPEAT): raise error, "multiple repeat" |