-
-
Notifications
You must be signed in to change notification settings - Fork 30.2k
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
bpo-39264: Fix UserDict.get() to account for __missing__() #17910
Conversation
Seems like ubuntu's archives are down. |
Misc/NEWS.d/next/Library/2020-01-09-01-57-12.bpo-39264.GsBL9-.rst
Outdated
Show resolved
Hide resolved
Co-authored-by: Rémi Lapeyre <[email protected]>
Co-authored-by: Rémi Lapeyre <[email protected]>
if key in self: | ||
return self[key] | ||
return default | ||
|
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.
Nit: Only one blank line so as to match the surrounding code.
def __contains__(self, key): | ||
return key in self.data | ||
|
||
def get(self, key, default=None): |
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.
Add a comment that get() is overridden to avoid a False positive when _missing_ is defined.
Closing and reopening to trigger the CI bots. |
@bharel: Status check is done, and it's a success ✅ . |
Python 3.12 no longer calls `UserDict.__missing__`. See python/cpython#17910.
Required a fix for fetching aliases from `RepodataState` since Python 3.12 no longer calls `UserDict.__missing__`. See python/cpython#17910. --------- Co-authored-by: Travis Hathaway <[email protected]> Co-authored-by: Jannis Leidel <[email protected]> Co-authored-by: Ken Odegard <[email protected]>
Here's the patch according to the discussion at the Python-Dev mailing list.
UserDict.get() will match dict's behavior and not call
__missing__
.https://bugs.python.org/issue39264
Automerge-Triggered-By: GH:rhettinger