diff --git a/iotlabcli/associations.py b/iotlabcli/associations.py index 246ab0c..2acb61e 100644 --- a/iotlabcli/associations.py +++ b/iotlabcli/associations.py @@ -109,6 +109,10 @@ def _value(self): def _sort(self): """Sort values with key.""" self._value().sort(key=self.VALUE_SORT_KEY) + # Sync C-level dict storage so CPython's json C encoder (which uses + # PyDict_GET_SIZE bypassing __len__) sees the correct data (Python>=3.12) + dict.clear(self) + dict.update(self, self.__dict__) # Get actual attributes name