-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Changed duck typing exception to: (ImportError, AttributeError) #7874
Conversation
…ow checking for missing attributes in imported packages
Thank you for opening this pull request! It may take us a few days to respond here, so thank you for being patient. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good. You might want to add an entry to whats-new.rst
, but otherwise I think we can merge.
…ta#7874) * Changed duck typing exception to (ImportError, AttributeError) to allow checking for missing attributes in imported packages * Updated whats-new.rst with the duck typing exception catch update of PR 7874. * Remove accidental url in whats-new * Issue number in whats-new.rst --------- Co-authored-by: Tom Nicholas <[email protected]>
As described in issue #7870, there is a name-collision with the astrophysics package
pint-pulsar
, which is used to do high-precision pulsar timing. That other package would get imported aspint
, and anAttributeError
is thrown because that imported package is not the expected package.By generalizing the duck typing exception to catch an
ImportError
and anAttributeError
, we catch such name-collisions. It fits the idea and goal of duck typing.This PR is a single-line change