Skip to content

Commit e6d7e28

Browse files
committed
revert more that would affect pickling
1 parent 8c10d70 commit e6d7e28

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

Lib/dataclasses.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,10 @@ class FrozenInstanceError(AttributeError): pass
172172
# A sentinel object for default values to signal that a default
173173
# factory will be used. This is given a nice repr() which will appear
174174
# in the function signature of dataclasses' constructors.
175-
_HAS_DEFAULT_FACTORY = sentinel('<factory>')
175+
class _HAS_DEFAULT_FACTORY_CLASS:
176+
def __repr__(self):
177+
return '<factory>'
178+
_HAS_DEFAULT_FACTORY = _HAS_DEFAULT_FACTORY_CLASS()
176179

177180
# A sentinel object to detect if a parameter is supplied or not.
178181
MISSING = sentinel("MISSING")

Lib/traceback.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,11 @@ def extract_tb(tb, limit=None):
136136
"another exception occurred:\n\n")
137137

138138

139-
_sentinel = sentinel("<implicit>")
139+
class _Sentinel:
140+
def __repr__(self):
141+
return "<implicit>"
142+
143+
_sentinel = _Sentinel()
140144

141145
def _parse_value_tb(exc, value, tb):
142146
if (value is _sentinel) != (tb is _sentinel):

0 commit comments

Comments
 (0)