Summary
Severity: High
File: sdk/basyx/aas/model/base.py:2046-2050
Description
NamespaceSet.pop() only removes the popped item from the first attribute backend. All remaining backends retain a stale reference.
def pop(self) -> _NSO:
_, value = next(iter(self._backend.values()))[0].popitem() # pops from backend[0] only
self._execute_item_del_hook(value)
value.parent = None
return value
self._backend maps each attribute name to its own dict. add() (line 1974-1975) inserts into all backend dicts. pop() only removes from the first one. All remaining backends retain a stale reference to the returned object. Subsequent __contains__, attribute lookups, or remove() calls will find the ghost entry and behave incorrectly.
Fix
After the popitem(), iterate all backends and delete the key for the popped value — the same loop pattern used in remove().
Summary
Severity: High
File:
sdk/basyx/aas/model/base.py:2046-2050Description
NamespaceSet.pop()only removes the popped item from the first attribute backend. All remaining backends retain a stale reference.self._backendmaps each attribute name to its own dict.add()(line 1974-1975) inserts into all backend dicts.pop()only removes from the first one. All remaining backends retain a stale reference to the returned object. Subsequent__contains__, attribute lookups, orremove()calls will find the ghost entry and behave incorrectly.Fix
After the
popitem(), iterate all backends and delete the key for the popped value — the same loop pattern used inremove().