summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2022-05-01 10:01:56 (GMT)
committerGitHub <noreply@github.com>2022-05-01 10:01:56 (GMT)
commit54f06aeb74909f6c3b0727e73987639732428751 (patch)
tree4b4a30aac54e14ea3302c8bb9b8bc157b6b31910
parentfcbff77b26c44b8ee58c2ef2c3b25b3ffe7c20e9 (diff)
downloadcpython-54f06aeb74909f6c3b0727e73987639732428751.zip
cpython-54f06aeb74909f6c3b0727e73987639732428751.tar.gz
cpython-54f06aeb74909f6c3b0727e73987639732428751.tar.bz2
[3.9] gh-92049: Forbid pickling constants re._constants.SUCCESS etc (GH-92070) (GH-92073) (GH-92102)
Previously, pickling did not fail, but the result could not be unpickled. (cherry picked from commit 6d0d547033e295f91f05030322acfbb0e280fc1f) (cherry picked from commit e8ff3c92f69b475aa20ba7c08efccbc329f9b42e)
-rw-r--r--Lib/sre_constants.py2
-rw-r--r--Misc/NEWS.d/next/Library/2022-04-30-10-53-10.gh-issue-92049.5SEKoh.rst2
2 files changed, 4 insertions, 0 deletions
diff --git a/Lib/sre_constants.py b/Lib/sre_constants.py
index 8e613cb..db3ca51 100644
--- a/Lib/sre_constants.py
+++ b/Lib/sre_constants.py
@@ -62,6 +62,8 @@ class _NamedIntConstant(int):
def __repr__(self):
return self.name
+ __reduce__ = None
+
MAXREPEAT = _NamedIntConstant(MAXREPEAT, 'MAXREPEAT')
def _makecodes(names):
diff --git a/Misc/NEWS.d/next/Library/2022-04-30-10-53-10.gh-issue-92049.5SEKoh.rst b/Misc/NEWS.d/next/Library/2022-04-30-10-53-10.gh-issue-92049.5SEKoh.rst
new file mode 100644
index 0000000..cad4621
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2022-04-30-10-53-10.gh-issue-92049.5SEKoh.rst
@@ -0,0 +1,2 @@
+Forbid pickling constants ``re._constants.SUCCESS`` etc. Previously,
+pickling did not fail, but the result could not be unpickled.