From d5fd94b4a9abd8ed1506dcb7d75981e5c356fc71 Mon Sep 17 00:00:00 2001 From: Philipp Holl Date: Thu, 19 Dec 2024 13:10:08 +0100 Subject: [PATCH] Exclude __setstate__ from possible BoundDim names --- phiml/dataclasses/_dataclasses.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phiml/dataclasses/_dataclasses.py b/phiml/dataclasses/_dataclasses.py index fea24b1..551c361 100644 --- a/phiml/dataclasses/_dataclasses.py +++ b/phiml/dataclasses/_dataclasses.py @@ -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)