diff --git a/Lib/sre_constants.py b/Lib/sre_constants.py index 8e613cb3fa5..db3ca51e830 100644 --- a/Lib/sre_constants.py +++ b/Lib/sre_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 00000000000..cad4621c650 --- /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.