summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2022-04-30 10:03:23 (GMT)
committerGitHub <noreply@github.com>2022-04-30 10:03:23 (GMT)
commit6d0d547033e295f91f05030322acfbb0e280fc1f (patch)
tree33930640605e644dea7ed7b61fee5ee7c86f0429
parent354ace8b07e7d445fd2de713b6af1271536adce0 (diff)
downloadcpython-6d0d547033e295f91f05030322acfbb0e280fc1f.zip
cpython-6d0d547033e295f91f05030322acfbb0e280fc1f.tar.gz
cpython-6d0d547033e295f91f05030322acfbb0e280fc1f.tar.bz2
gh-92049: Forbid pickling constants re._constants.SUCCESS etc (GH-92070)
Previously, pickling did not fail, but the result could not be unpickled.
-rw-r--r--Lib/re/_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/re/_constants.py b/Lib/re/_constants.py
index c45ce40..71204d9 100644
--- a/Lib/re/_constants.py
+++ b/Lib/re/_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.