Uh oh!
There was an error while loading. Please reload this page.
gh-111262: Make PyDict_Pop() public - #111263
Closed
scoder wants to merge 1 commit into
Closed
Conversation
scoderforce-pushed
the
py313_pydict_capi
branch
from
October 24, 2023 14:04
5674aa3 to
9c8539bCompare…have been public right away. See python#108449
scoderforce-pushed
the
py313_pydict_capi
branch
from
October 24, 2023 14:05
9c8539b to
16a95d4Comparescoder
commented
Oct 24, 2023
ContributorAuthor
| .. versionadded:: 3.4 | ||
| .. c:function:: PyObject* PyDict_Pop(PyObject *p, PyObject *key, PyObject *defaultobj) |
Member
There was a problem hiding this comment.
I would prefer to return -1 on error, 0 if the key doesn't exist, 1 if the key exists.
Member
There was a problem hiding this comment.
How would the caller know the popped value then?
pitrou
reviewed
Nov 9, 2023
| { | ||
| if (!PyDict_Check(dict)) { | ||
| PyErr_BadInternalCall(); | ||
| return -1; |
vstinner
commented
Nov 10, 2023
Member
I created PR #111939 based on this PR: I changed the API and added tests. |
vstinner
commented
Nov 14, 2023
Member
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 freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See #108449
I kept the internal function since it saves the type check on the fast path and can thus still be used internally.
📚 Documentation preview 📚: https://cpython-previews--111263.org.readthedocs.build/