Add "raise from" on keyerror.

This commit is contained in:
voussoir 2024-03-07 19:10:18 -08:00
parent e24e89a04b
commit 24f74e9ee4

View file

@ -20,10 +20,10 @@ class DotDict:
def __getattr__(self, key):
try:
return self.__dict__[key]
except KeyError:
except KeyError as exc:
if self.__default is not NO_DEFAULT:
return self.__default
raise
raise AttributeError from exc
def __setattr__(self, key, value):
self.__dict__[key] = value