bpo-47256: re module, limit the maximum capturing group to 1,073,741,823, increasing the depth of backtracking. · Pull Request #32411 · python/cpython

@ghost ghost mentioned this pull request

Apr 15, 2022

serhiy-storchaka

These types are kept as Py_ssize_t:
  - PatternObject.groups
  - MatchObject.lastindex
  - MatchObject.groups

- On 32 bit platform: 36 bytes, no change.  (msvc2022)
- On 64 bit platform: 72 bytes -> 64 bytes. (msvc2022/gcc9.4)
change the type of `SRE(match_context).jump` from Py_ssize_t to int

- On 32 bit platform: 36 bytes, no change.  (msvc2022)
- On 64 bit platform: 64 bytes -> 56 bytes. (msvc2022/gcc9.4)

And make the order of `DO_JUMPX` macro and `SRE(match_context)` struct consistent.
DATA_STACK_(PUSH|POP) macros use the size multiple time, now computed value is propagated.

@wjssz

serhiy-storchaka

@wjssz

serhiy-storchaka

@ghost ghost deleted the context_size branch

April 18, 2022 14:03