mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
SF patch #720991 by Gary Herron:
A small fix for bug #545855 and Greg Chapman's addition of op code SRE_OP_MIN_REPEAT_ONE for eliminating recursion on simple uses of pattern '*?' on a long string.
This commit is contained in:
parent
44c62ef5ee
commit
41c99e7f96
7 changed files with 89 additions and 4 deletions
|
@ -55,8 +55,11 @@ def _compile(code, pattern, flags):
|
|||
_compile(code, av[2], flags)
|
||||
emit(OPCODES[SUCCESS])
|
||||
code[skip] = len(code) - skip
|
||||
elif _simple(av) and op == MAX_REPEAT:
|
||||
emit(OPCODES[REPEAT_ONE])
|
||||
elif _simple(av) and op != REPEAT:
|
||||
if op == MAX_REPEAT:
|
||||
emit(OPCODES[REPEAT_ONE])
|
||||
else:
|
||||
emit(OPCODES[MIN_REPEAT_ONE])
|
||||
skip = len(code); emit(0)
|
||||
emit(av[0])
|
||||
emit(av[1])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue