GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-112026: Restore removed _PyDict_GetItemStringWithError() by vstinner · Pull Request #112119 · python/cpython

Conversation

@vstinner

@vstinner vstinner commented Nov 15, 2023 •
edited by bedevere-app Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

Restore the removed _PyDict_GetItemStringWithError() function. It is used by numpy.

  • Issue: [C API] Revert of private functions removed in Python 3.13 causing most problems #112026

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@vstinner
pythongh-112026: Restore removed _PyDict_GetItemStringWithError()
4a1d912
Restore the removed _PyDict_GetItemStringWithError() function. It is
used by numpy.
@vstinner
vstinner requested review from markshannon and methane as code owners November 15, 2023 16:48
@bedevere-app bedevere-app Bot added the awaiting core review label Nov 15, 2023
@bedevere-app bedevere-app Bot mentioned this pull request Nov 15, 2023
[C API] Revert of private functions removed in Python 3.13 causing most problems #112026
Closed
@vstinner

vstinner commented Nov 15, 2023

Copy link
Copy Markdown
Member Author

@serhiy-storchaka: This private function is no longer used by Python, but I restore it to unblock numpy on Python 3.13 (keep dependency in the Python ecosystem). Later, I plan to deprecate this function and write documentation on how to update existing code using it. Apparently, just removing private functions without providing any solution didn't "please" users.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vstinner
vstinner enabled auto-merge (squash) November 15, 2023 16:50
@vstinner
vstinner merged commit bd2f148 into python:main Nov 15, 2023
@vstinner
vstinner deleted the restore_dict_geterror branch November 15, 2023 17:10
@bedevere-app bedevere-app Bot removed the awaiting core review label Nov 15, 2023
@serhiy-storchaka

serhiy-storchaka commented Nov 15, 2023

Copy link
Copy Markdown
Member

Is not PyDict_GetItemStringRef() the solution? It bhas different interface, but it is easy to write a wrapper.

PyObject *
_PyDict_GetItemStringWithError(PyObject *obj, const char *key)
{
    PyObject *value;
    (void)PyDict_GetItemStringRef(obj, key, &value);
    if (Py_REFCNT(value) == 1) {
        Py_DECREF(value);
        return NULL;
    }
    Py_DECREF(value);
    return value;
}
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vstinner

vstinner commented Nov 15, 2023

Copy link
Copy Markdown
Member Author

Is not PyDict_GetItemStringRef() the solution? It bhas different interface, but it is easy to write a wrapper.

Solution to which problem? numpy doesn't built if Python C API doesn't contain _PyDict_GetItemStringWithError(). I restored the function to unblock numpy.

I plan to update numpy, deprecate _PyDict_GetItemStringWithError(), and later remove it.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

aisk pushed a commit to aisk/cpython that referenced this pull request Feb 11, 2024
@vstinner @aisk
pythongh-112026: Restore removed _PyDict_GetItemStringWithError() (py…
5bbdafe
…thon#112119)

Restore the removed _PyDict_GetItemStringWithError() function. It is
used by numpy.
@ngoldbaum

ngoldbaum commented Apr 15, 2024

Copy link
Copy Markdown
Contributor

I plan to update numpy

See numpy/numpy#26282, would also appreciate code review if you have time.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vstinner vstinner mentioned this pull request May 31, 2024
gh-112026: Deprecate _PyDict_GetItemStringWithError() function #119855
Merged
@vstinner

vstinner commented May 31, 2024

Copy link
Copy Markdown
Member Author

Is not PyDict_GetItemStringRef() the solution? It bhas different interface, but it is easy to write a wrapper.

I wrote #119855 to deprecate _PyDict_GetItemStringWithError().

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Glyphack pushed a commit to Glyphack/cpython that referenced this pull request Sep 2, 2024
@vstinner @Glyphack
pythongh-112026: Restore removed _PyDict_GetItemStringWithError() (py…
4c7e8fd
…thon#112119)

Restore the removed _PyDict_GetItemStringWithError() function. It is
used by numpy.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@methane methane Awaiting requested review from methane methane is a code owner
@markshannon markshannon Awaiting requested review from markshannon markshannon is a code owner

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@vstinner @serhiy-storchaka @ngoldbaum
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.