Skip to content

Commit

Permalink
Exclude __setstate__ from possible BoundDim names
Browse files Browse the repository at this point in the history
  • Loading branch information
holl- committed Dec 19, 2024
1 parent 06e801b commit d5fd94b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion phiml/dataclasses/_dataclasses.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def __dataclass_getitem__(obj, item):
cls.__getitem__ = __dataclass_getitem__
if dim_attrs and not hasattr(cls, '__getattr__'):
def __dataclass_getattr__(obj, name: str):
if name in ('shape', '__shape__', '__all_attrs__', '__variable_attrs__', '__value_attrs__'): # these can cause infinite recursion
if name in ('shape', '__shape__', '__all_attrs__', '__variable_attrs__', '__value_attrs__', '__setstate__'): # these can cause infinite recursion
raise AttributeError(f"'{type(obj)}' instance has no attribute '{name}'")
if name in shape(obj):
return BoundDim(obj, name)
Expand Down

0 comments on commit d5fd94b

Please sign in to comment.