Fix for AttributeError values only usable in Python 3.10
@@ -34,6 +34,7 @@ class OptionsInterface:
def __setattr__(self, item: str, value: Any) -> None:
if not hasattr(self, item) and item not in self.keys():
exc = AttributeError(f"'{type(self).__name__}' object has no attribute '{item}'")
+ if hasattr(exc, "name") and hasattr(exc, "obj"):
exc.name = item
exc.obj = self
raise exc
@@ -48,6 +49,7 @@ class OptionsInterface:
if not hasattr(self, item):
exc = AttributeError(f"'{type(self).__name__}' object has no attribute '{item}'")
+ if hasattr(exc, "name") and hasattr(exc, "obj"):
exc.name = item
exc.obj = self
raise exc
