From ab456e8fb96ad3564e9417d70976ca33c4d93660 Mon Sep 17 00:00:00 2001 From: Matthias Diener Date: Thu, 21 Nov 2024 19:22:45 -0600 Subject: [PATCH] no clue why this works --- pytato/array.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/pytato/array.py b/pytato/array.py index 95c5e7a59..97a82e557 100644 --- a/pytato/array.py +++ b/pytato/array.py @@ -367,6 +367,8 @@ def _augment_array_dataclass( from pytools.codegen import remove_common_indentation augment_code = remove_common_indentation( f""" + import dataclasses + def {cls.__name__}_hash(self): try: return self._hash_value @@ -379,12 +381,8 @@ def {cls.__name__}_hash(self): cls.__hash__ = {cls.__name__}_hash - def {cls.__name__}_getstate(self): - # This must not return the cached hash value. - return {{name: val - for name, val in zip({fld_name_tuple}, {attr_tuple}, strict=True)}} - - cls.__getstate__ = {cls.__name__}_getstate + cls.__getstate__ = dataclasses._dataclass_getstate + cls.__setstate__ = dataclasses._dataclass_setstate """) exec_dict = {"cls": cls, "_MODULE_SOURCE_CODE": augment_code} exec(compile(augment_code,