[Python-checkins] gh-92049: Forbid pickling constants re._constants.SUCCESS etc (GH-92070)
serhiy-storchaka
webhook-mailer at python.org
Sat Apr 30 06:03:27 EDT 2022
https://github.com/python/cpython/commit/6d0d547033e295f91f05030322acfbb0e280fc1f
commit: 6d0d547033e295f91f05030322acfbb0e280fc1f
branch: main
author: Serhiy Storchaka <storchaka at gmail.com>
committer: serhiy-storchaka <storchaka at gmail.com>
date: 2022-04-30T13:03:23+03:00
summary:
gh-92049: Forbid pickling constants re._constants.SUCCESS etc (GH-92070)
Previously, pickling did not fail, but the result could not be unpickled.
files:
A Misc/NEWS.d/next/Library/2022-04-30-10-53-10.gh-issue-92049.5SEKoh.rst
M Lib/re/_constants.py
diff --git a/Lib/re/_constants.py b/Lib/re/_constants.py
index c45ce409e21b8..71204d903b322 100644
--- a/Lib/re/_constants.py
+++ b/Lib/re/_constants.py
@@ -62,6 +62,8 @@ def __new__(cls, value, name):
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 0000000000000..cad4621c65096
--- /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.
More information about the Python-checkins
mailing list