]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.9] gh-92049: Forbid pickling constants re._constants.SUCCESS etc (GH-92070) (GH...
authorSerhiy Storchaka <storchaka@gmail.com>
Sun, 1 May 2022 10:01:56 +0000 (13:01 +0300)
committerGitHub <noreply@github.com>
Sun, 1 May 2022 10:01:56 +0000 (13:01 +0300)
Previously, pickling did not fail, but the result could not be unpickled.
(cherry picked from commit 6d0d547033e295f91f05030322acfbb0e280fc1f)
(cherry picked from commit e8ff3c92f69b475aa20ba7c08efccbc329f9b42e)

Lib/sre_constants.py
Misc/NEWS.d/next/Library/2022-04-30-10-53-10.gh-issue-92049.5SEKoh.rst [new file with mode: 0644]

index 8e613cb3fa5dcbae0c58b1b04f7e397863b911d9..db3ca51e8306addd4549e0767f396e0b50e35e8f 100644 (file)
@@ -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 (file)
index 0000000..cad4621
--- /dev/null
@@ -0,0 +1,2 @@
+Forbid pickling constants ``re._constants.SUCCESS`` etc. Previously,
+pickling did not fail, but the result could not be unpickled.