mirror of
https://github.com/python/cpython.git
synced 2025-11-01 10:45:30 +00:00
gh-109747: Improve errors for unsupported look-behind patterns (GH-109859)
Now re.error is raised instead of OverflowError or RuntimeError for too large width of look-behind pattern. The limit is increased to 2**32-1 (was 2**31-1).
This commit is contained in:
parent
ca0f3d858d
commit
e2b3d831fd
6 changed files with 46 additions and 13 deletions
|
|
@ -2070,8 +2070,6 @@ _validate_inner(SRE_CODE *code, SRE_CODE *end, Py_ssize_t groups)
|
|||
GET_SKIP;
|
||||
GET_ARG; /* 0 for lookahead, width for lookbehind */
|
||||
code--; /* Back up over arg to simplify math below */
|
||||
if (arg & 0x80000000)
|
||||
FAIL; /* Width too large */
|
||||
/* Stop 1 before the end; we check the SUCCESS below */
|
||||
if (_validate_inner(code+1, code+skip-2, groups))
|
||||
FAIL;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue