FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

bpo-39264: Fix UserDict.get() to account for __missing__() by bharel · Pull Request #17910 · python/cpython · GitHub

Repository navigation

bpo-39264: Fix UserDict.get() to account for __missing__() - #17910

Merged
miss-islington merged 11 commits into
python:mainfrom
bharel:fix-userdict-get
May 10, 2022
Merged

miss-islington merged 11 commits into
python:mainfrom
bharel:fix-userdict-get

Conversation

bharel commented Jan 9, 2020 •
edited by miss-islington
Loading

Copy link
Copy Markdown
Contributor

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

bharel commented Jan 9, 2020

Copy link
Copy Markdown
Contributor Author

Seems like ubuntu's archives are down.

Comment thread Lib/test/test_collections.py Outdated
bharel and others added 2 commits March 1, 2021 15:44
Co-authored-by: Rémi Lapeyre <remi.lapeyre@henki.fr>
Co-authored-by: Rémi Lapeyre <remi.lapeyre@henki.fr>
if key in self:
return self[key]
return default

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Add a comment that get() is overridden to avoid a False positive when _missing_ is defined.

Copy link
Copy Markdown
Contributor

Closing and reopening to trigger the CI bots.

Copy link
Copy Markdown
Contributor

@bharel: Status check is done, and it's a success ✅ .

kenodegard added a commit to johnnynunez/conda that referenced this pull request Dec 11, 2023
Python 3.12 no longer calls `UserDict.__missing__`. See python/cpython#17910.
kenodegard added a commit to conda/conda that referenced this pull request Dec 12, 2023
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 <travis.j.hathaway@gmail.com>
Co-authored-by: Jannis Leidel <jannis@leidel.info>
Co-authored-by: Ken Odegard <kodegard@anaconda.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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

Successfully merging this pull request may close these issues.

6 participants


Back | FazBrowse Home | New Git URL