From 19e1a8f55f5d2aea6a9367b2bd5bd185c21fd36e Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Sat, 30 Apr 2022 10:50:42 +0300 Subject: [PATCH] gh-92049: Forbid pickling constants re._constants.SUCCESS etc Previously, pickling did not fail, but the result could not be unpickled. --- Lib/re/_constants.py | 2 ++ .../next/Library/2022-04-30-10-53-10.gh-issue-92049.5SEKoh.rst | 2 ++ 2 files changed, 4 insertions(+) create mode 100644 Misc/NEWS.d/next/Library/2022-04-30-10-53-10.gh-issue-92049.5SEKoh.rst diff --git a/Lib/re/_constants.py b/Lib/re/_constants.py index c45ce409e21b85..71204d903b3226 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 00000000000000..cad4621c65096c --- /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.