Skip to content

gh-141510 Update mapping methods in abstract.c to accept frozendict#150692

Merged
vstinner merged 3 commits into
python:mainfrom
da-woods:patch-4
Jun 19, 2026
Merged

gh-141510 Update mapping methods in abstract.c to accept frozendict#150692
vstinner merged 3 commits into
python:mainfrom
da-woods:patch-4

Conversation

@da-woods

@da-woods da-woods commented May 31, 2026

Copy link
Copy Markdown
Contributor

... as well as dict.

Specifically PyMapping_GetOptionalItem, PyMapping_Keys, PyMapping_Values and PyMapping_Items.

…dict

Specifically `PyMapping_GetOptionalItem`, `PyMapping_Keys`, `PyMapping_Values` and `PyMapping_Items`.
@da-woods

da-woods commented May 31, 2026

Copy link
Copy Markdown
Contributor Author

I think this is probably OK to attach to the "frozendict" implementation issue, but I can change it if not

(Edit: although I originally linked it to a previous proposal...)

@da-woods da-woods changed the title gh-58370 Update mapping methods in abstract.c to accept frozendict gh-141510 Update mapping methods in abstract.c to accept frozendict Jun 4, 2026

@vstinner vstinner left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please update test_mapping_keys_valuesitems() of Lib/test/test_capi/test_abstract.py to test frozendict.

Sadly, PyMapping_GetOptionalItem() doesn't seem to be tested by test_capi so far. But that can be done in another PR.

@vstinner vstinner left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM. Thanks for added tests, they seem to cover well your C changes.

@vstinner vstinner added the needs backport to 3.15 pre-release feature fixes, bugs and security fixes label Jun 19, 2026
@vstinner

Copy link
Copy Markdown
Member

Tests / Sanitizers / TSan (free-threading) (pull_request): Cancelled after 60m

test_abc hangs in Parallel Tests: that's the known issue #151593.

Another issue is that installing dependencies took 33 minutes.

I re-run the job.

@vstinner vstinner enabled auto-merge (squash) June 19, 2026 08:19
@vstinner vstinner merged commit a5568d0 into python:main Jun 19, 2026
104 of 106 checks passed
@miss-islington-app

Copy link
Copy Markdown

Thanks @da-woods for the PR, and @vstinner for merging it 🌮🎉.. I'm working now to backport this PR to: 3.15.
🐍🍒⛏🤖

@bedevere-app

bedevere-app Bot commented Jun 19, 2026

Copy link
Copy Markdown

GH-151704 is a backport of this pull request to the 3.15 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.15 pre-release feature fixes, bugs and security fixes label Jun 19, 2026
vstinner pushed a commit that referenced this pull request Jun 19, 2026
…151704)

gh-141510 Add frozendict fast paths to abstract.c (GH-150692)

Add frozendict to the fast paths of PyMapping_GetOptionalItem(),
PyMapping_Keys(), PyMapping_Values(), and PyMapping_Items().
(cherry picked from commit a5568d0)

Co-authored-by: da-woods <dw-git@d-woods.co.uk>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
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.

2 participants