gh-91870: Remove unsupported SRE opcode CALL (GH-91872)

It was initially added to support atomic groups, but that
support was never fully implemented, and CALL was only left
in the compiler, but not interpreter and parser.

ATOMIC_GROUP is now used to support atomic groups.
This commit is contained in:
Serhiy Storchaka 2022-04-26 21:07:25 +03:00 committed by GitHub
parent 1af871eeee
commit f703c96cf0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 38 additions and 52 deletions

View file

@ -164,12 +164,6 @@ def _compile(data, pattern, flags):
_compile(data, av[1], flags)
emit(SUCCESS)
code[skip] = _len(code) - skip
elif op is CALL:
emit(op)
skip = _len(code); emit(0)
_compile(data, av, flags)
emit(SUCCESS)
code[skip] = _len(code) - skip
elif op is AT:
emit(op)
if flags & SRE_FLAG_MULTILINE:

View file

@ -13,7 +13,7 @@
# update when constants are added or removed
MAGIC = 20220402
MAGIC = 20220423
from _sre import MAXREPEAT, MAXGROUPS
@ -78,7 +78,6 @@ OPCODES = _makecodes(
'ASSERT', 'ASSERT_NOT',
'AT',
'BRANCH',
'CALL',
'CATEGORY',
'CHARSET', 'BIGCHARSET',
'GROUPREF', 'GROUPREF_EXISTS',

View file

@ -183,10 +183,6 @@ class SubPattern:
j = max(j, h)
lo = lo + i
hi = hi + j
elif op is CALL:
i, j = av.getwidth()
lo = lo + i
hi = hi + j
elif op is ATOMIC_GROUP:
i, j = av.getwidth()
lo = lo + i