mirror of
https://github.com/python/cpython.git
synced 2025-07-12 13:55:34 +00:00
Issue #13169: The maximal repetition number in a regular expression has been
increased from 65534 to 2147483647 (on 32-bit platform) or 4294967294 (on 64-bit).
This commit is contained in:
parent
b19ed57d8d
commit
70ca0210e8
7 changed files with 62 additions and 13 deletions
|
@ -15,6 +15,7 @@
|
|||
import sys
|
||||
|
||||
from sre_constants import *
|
||||
from _sre import MAXREPEAT
|
||||
|
||||
SPECIAL_CHARS = ".\\[{()*+?^$|"
|
||||
REPEAT_CHARS = "*+?{"
|
||||
|
@ -505,10 +506,14 @@ def _parse(source, state):
|
|||
continue
|
||||
if lo:
|
||||
min = int(lo)
|
||||
if min >= MAXREPEAT:
|
||||
raise OverflowError("the repetition number is too large")
|
||||
if hi:
|
||||
max = int(hi)
|
||||
if max < min:
|
||||
raise error("bad repeat interval")
|
||||
if max >= MAXREPEAT:
|
||||
raise OverflowError("the repetition number is too large")
|
||||
if max < min:
|
||||
raise error("bad repeat interval")
|
||||
else:
|
||||
raise error("not supported")
|
||||
# figure out which item to repeat
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue