Skip to content

Commit

Permalink
add an explanation
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiasdiener committed Nov 22, 2024
1 parent d5fcd6d commit 3119a64
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pytato/array.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,12 @@ def {cls.__name__}_hash(self):
cls.__hash__ = {cls.__name__}_hash
# By default (when slots=False), dataclasses do not have special
# handling for pickling, using pickle's default behavior that
# looks at obj.__dict__. This would also pickle the cached hash,
# which may change across invocations. Here, we override the
# pickling methods such that only fields are pickled.
# See also https://github.com/python/cpython/blob/5468d219df65d4fe3335e2bcc09d2f6032a32c70/Lib/dataclasses.py#L1267-L1272
cls.__getstate__ = dataclasses._dataclass_getstate
cls.__setstate__ = dataclasses._dataclass_setstate
""")
Expand Down

0 comments on commit 3119a64

Please sign in to comment.