Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-111262: Make PyDict_Pop() public#111263

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed
scoder wants to merge1 commit intopython:mainfromscoder:py313_pydict_capi

Conversation

scoder
Copy link
Contributor

@scoderscoder commentedOct 24, 2023
edited by github-actionsbot
Loading

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/

pitrou reacted with thumbs up emoji
@scoder
Copy link
ContributorAuthor

@vstinner

@brandtbucherbrandtbucher added type-featureA feature request or enhancement interpreter-core(Objects, Python, Grammar, and Parser dirs) topic-C-API labelsOct 24, 2023
Copy link
Member

@vstinnervstinner left a comment

Choose a reason for hiding this comment

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

The change lacks tests.

@@ -173,6 +173,16 @@ Dictionary Objects

.. versionadded:: 3.4


.. c:function:: PyObject* PyDict_Pop(PyObject *p, PyObject *key, PyObject *defaultobj)
Copy link
Member

Choose a reason for hiding this comment

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

I would prefer to return -1 on error, 0 if the key doesn't exist, 1 if the key exists.

Copy link
Member

Choose a reason for hiding this comment

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

How would the caller know the poppedvalue then?

{
if (!PyDict_Check(dict)) {
PyErr_BadInternalCall();
return -1;
Copy link
Member

Choose a reason for hiding this comment

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

Should certainly bereturn NULL?

@vstinner
Copy link
Member

I created PR#111939 based on this PR: I changed the API and added tests.

@vstinner
Copy link
Member

I close this PR:#112028 was merged with a different API. Thanks@scoder, I wrote my PR based on yours ;-) And thanks for raising the need for such API.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@vstinnervstinnervstinner left review comments

@pitroupitroupitrou left review comments

@methanemethaneAwaiting requested review from methanemethane is a code owner

@markshannonmarkshannonAwaiting requested review from markshannonmarkshannon is a code owner

Assignees
No one assigned
Labels
awaiting core reviewinterpreter-core(Objects, Python, Grammar, and Parser dirs)topic-C-APItype-featureA feature request or enhancement
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

4 participants
@scoder@vstinner@pitrou@brandtbucher

[8]ページ先頭

©2009-2025 Movatter.jp