Skip to content

Commit 4b7c0d6

Browse files
Harden TreeStore cache assignments with defensive copies
Agent-Logs-Url: https://github.com/Blosc/python-blosc2/sessions/973a79eb-d0c3-43ac-8008-54a9bd392be0 Co-authored-by: FrancescAlted <314521+FrancescAlted@users.noreply.github.com>
1 parent 881f37b commit 4b7c0d6

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/blosc2/tree_store.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ def _known_object_roots(self) -> set:
262262
registered = self._object_roots()
263263
# Fast path: when registry exists, avoid costly full-store probing.
264264
roots = registered if registered else self._probed_object_roots()
265-
self._known_object_roots_cache = roots
265+
self._known_object_roots_cache = set(roots)
266266
return set(roots)
267267

268268
def _effective_object_roots(self) -> set:
@@ -276,7 +276,7 @@ def _effective_object_roots(self) -> set:
276276

277277
all_roots = self._known_object_roots()
278278
if not self.subtree_path:
279-
self._effective_object_roots_cache = (current_subtree_path, all_roots)
279+
self._effective_object_roots_cache = (current_subtree_path, set(all_roots))
280280
return set(all_roots)
281281
result = set()
282282
for full_key in all_roots:

0 commit comments

Comments
 (0)