Skip to content

Conversation

@ZeroIntensity
Copy link
Member

@ZeroIntensity ZeroIntensity commented Nov 5, 2025

Copy link
Member

@StanFromIreland StanFromIreland left a comment

Choose a reason for hiding this comment

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

LGTM

Tangent: I must say it is a curious duplication (albeit demoting checks to an assert(PyDict_Check(op));), but I did not look much into it, there may be some good reasoning. Although it seems like something that should be deprecated.

@ZeroIntensity
Copy link
Member Author

ZeroIntensity commented Nov 5, 2025

We have similar variations for other APIs, such as PyList_GET_SIZE and PyTuple_GET_SIZE. When you're certain that the object is of the correct type, it's faster to use these. PyDict_GET_SIZE seems to be used in quite a few third-party packages, so I'm opposed to deprecating it.

Thanks for the review!

@ZeroIntensity ZeroIntensity added needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes labels Nov 5, 2025
@ZeroIntensity ZeroIntensity merged commit f0ab07f into python:main Nov 5, 2025
39 checks passed
@ZeroIntensity ZeroIntensity deleted the document-pydict-get-size branch November 5, 2025 22:32
@github-project-automation github-project-automation bot moved this from Todo to Done in Docs PRs Nov 5, 2025
@miss-islington-app
Copy link

Thanks @ZeroIntensity for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Nov 5, 2025
(cherry picked from commit f0ab07f)

Co-authored-by: Peter Bierma <[email protected]>
@bedevere-app
Copy link

bedevere-app bot commented Nov 5, 2025

GH-141082 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.14 bugs and security fixes label Nov 5, 2025
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Nov 5, 2025
(cherry picked from commit f0ab07f)

Co-authored-by: Peter Bierma <[email protected]>
@bedevere-app
Copy link

bedevere-app bot commented Nov 5, 2025

GH-141083 is a backport of this pull request to the 3.13 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.13 bugs and security fixes label Nov 5, 2025
ZeroIntensity added a commit that referenced this pull request Nov 5, 2025
gh-141004: Document `PyDict_GET_SIZE` (GH-141078)
(cherry picked from commit f0ab07f)

Co-authored-by: Peter Bierma <[email protected]>
ZeroIntensity added a commit that referenced this pull request Nov 5, 2025
gh-141004: Document `PyDict_GET_SIZE` (GH-141078)
(cherry picked from commit f0ab07f)

Co-authored-by: Peter Bierma <[email protected]>
StanFromIreland pushed a commit to StanFromIreland/cpython that referenced this pull request Dec 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation in the Doc dir skip news

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants