summaryrefslogtreecommitdiffstats
path: root/Lib/re/_compiler.py
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2022-05-25 06:32:20 (GMT)
committerGitHub <noreply@github.com>2022-05-25 06:32:20 (GMT)
commit74b205b3eb6432d81d745da1dae4359e42ae76d4 (patch)
treef8c35e40543963fbc51066a94cde7b3425ba01ef /Lib/re/_compiler.py
parent7a5f190c9fa7c6cbd334dfea9ae6032ac886dd89 (diff)
downloadcpython-74b205b3eb6432d81d745da1dae4359e42ae76d4.zip
cpython-74b205b3eb6432d81d745da1dae4359e42ae76d4.tar.gz
cpython-74b205b3eb6432d81d745da1dae4359e42ae76d4.tar.bz2
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 b09184bf05b07b77c5ecfedd4daa846be3cbf0a9. (cherry picked from commit 16a7e4a0b75080275bf12cfb71d54b01d85099b2) Co-authored-by: Miro HronĨok <miro@hroncok.cz>
Diffstat (limited to 'Lib/re/_compiler.py')
-rw-r--r--Lib/re/_compiler.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/Lib/re/_compiler.py b/Lib/re/_compiler.py
index 63d8202..4b53223 100644
--- a/Lib/re/_compiler.py
+++ b/Lib/re/_compiler.py
@@ -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)