gh-92728: Restore re.template, but deprecate it (GH-93161)

Revert "bpo-47211: Remove function re.template() and flag re.TEMPLATE (GH-32300)"

This reverts commit b09184bf05.
This commit is contained in:
Miro Hrončok 2022-05-25 08:05:35 +02:00 committed by GitHub
parent 08e4e887f2
commit 16a7e4a0b7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 65 additions and 5 deletions

View file

@ -108,6 +108,8 @@ def _compile(data, pattern, flags):
else:
emit(ANY)
elif op in REPEATING_CODES:
if flags & SRE_FLAG_TEMPLATE:
raise error("internal: unsupported template operator %r" % (op,))
if _simple(av[2]):
emit(REPEATING_CODES[op][2])
skip = _len(code); emit(0)