Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hasattr() throws an exception when called on DottedDict #15

Open
RusAD32 opened this issue Mar 2, 2020 · 0 comments
Open

hasattr() throws an exception when called on DottedDict #15

RusAD32 opened this issue Mar 2, 2020 · 0 comments

Comments

@RusAD32
Copy link

RusAD32 commented Mar 2, 2020

hasattr() in python is implemented by calling __getattr__ and checking whether it threw AttributeError. Since for DottedDict __getattr__ = __getitem__, a KeyError is thrown and not AttributeError, therefore hasattr can fall with an exception instead of returning False

The simplest fix that I came up with is in pr #14

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant