Skip to content

Commit 6d0d547

Browse files
gh-92049: Forbid pickling constants re._constants.SUCCESS etc (GH-92070)
Previously, pickling did not fail, but the result could not be unpickled.
1 parent 354ace8 commit 6d0d547

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

Lib/re/_constants.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ def __new__(cls, value, name):
6262
def __repr__(self):
6363
return self.name
6464

65+
__reduce__ = None
66+
6567
MAXREPEAT = _NamedIntConstant(MAXREPEAT, 'MAXREPEAT')
6668

6769
def _makecodes(*names):
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Forbid pickling constants ``re._constants.SUCCESS`` etc. Previously,
2+
pickling did not fail, but the result could not be unpickled.

0 commit comments

Comments
 (0)