mirror of
https://github.com/tiqi-group/pydase.git
synced 2025-12-31 09:51:19 +01:00
suppresses KeyError when removing key from observable dict mapping
This error is thrown in some test cases when some object gets deleted but it's not within the dict mapping for some reason.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import contextlib
|
||||
import logging
|
||||
import weakref
|
||||
from abc import ABC, abstractmethod
|
||||
@@ -252,7 +253,8 @@ class _ObservableDict(ObservableObject, dict[str, Any]):
|
||||
self.__setitem__(key, self._initialise_new_objects(f'["{key}"]', value))
|
||||
|
||||
def __del__(self) -> None:
|
||||
self._dict_mapping.pop(id(self._original_dict))
|
||||
with contextlib.suppress(KeyError):
|
||||
self._dict_mapping.pop(id(self._original_dict))
|
||||
|
||||
def __setitem__(self, key: str, value: Any) -> None:
|
||||
if not isinstance(key, str):
|
||||
|
||||
Reference in New Issue
Block a user