summaryrefslogtreecommitdiffstats
path: root/Modules/_sre
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 /Modules/_sre
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 'Modules/_sre')
-rw-r--r--Modules/_sre/sre.c1
-rw-r--r--Modules/_sre/sre_constants.h1
2 files changed, 2 insertions, 0 deletions
diff --git a/Modules/_sre/sre.c b/Modules/_sre/sre.c
index bd9204d..491734f 100644
--- a/Modules/_sre/sre.c
+++ b/Modules/_sre/sre.c
@@ -1323,6 +1323,7 @@ pattern_repr(PatternObject *obj)
const char *name;
int value;
} flag_names[] = {
+ {"re.TEMPLATE", SRE_FLAG_TEMPLATE},
{"re.IGNORECASE", SRE_FLAG_IGNORECASE},
{"re.LOCALE", SRE_FLAG_LOCALE},
{"re.MULTILINE", SRE_FLAG_MULTILINE},
diff --git a/Modules/_sre/sre_constants.h b/Modules/_sre/sre_constants.h
index d5de650..590d5be 100644
--- a/Modules/_sre/sre_constants.h
+++ b/Modules/_sre/sre_constants.h
@@ -85,6 +85,7 @@
#define SRE_CATEGORY_UNI_NOT_WORD 15
#define SRE_CATEGORY_UNI_LINEBREAK 16
#define SRE_CATEGORY_UNI_NOT_LINEBREAK 17
+#define SRE_FLAG_TEMPLATE 1
#define SRE_FLAG_IGNORECASE 2
#define SRE_FLAG_LOCALE 4
#define SRE_FLAG_MULTILINE 8