mirror of
https://github.com/python/cpython.git
synced 2025-07-12 13:55:34 +00:00
detect attempts to repeat anchors (fixes bug #130748)
This commit is contained in:
parent
8ac3627b91
commit
c0c7ee3a65
2 changed files with 5 additions and 0 deletions
|
@ -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"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue