From 31a3bf0a05bb9b1e63da7c8517da002fcef27140 Mon Sep 17 00:00:00 2001 From: Alexandre Abadie Date: Mon, 18 May 2026 13:46:57 +0200 Subject: [PATCH] associations: fix MapAssociation dict with Python >=3.12 --- iotlabcli/associations.py | 4 ++++ 1 file changed, 4 insertions(+) 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