Skip to content

Conversation

@vstinner
Copy link
Member

@vstinner vstinner commented May 31, 2024

@vstinner
Copy link
Member Author

The function was removed in Python 3.13 alpha1 and added back to Python 3.13 alpha2 by #112119.

@vstinner
Copy link
Member Author

cc @serhiy-storchaka

Copy link
Member

@serhiy-storchaka serhiy-storchaka left a comment

Choose a reason for hiding this comment

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

I do not think we should bother with deprecating the internal C API. It can be removed or changed in incompatible way at any time.

Py_hash_t hash);
PyAPI_FUNC(PyObject *) _PyDict_GetItemStringWithError(PyObject *, const char *);
// PyDict_GetItemStringRef() can be used instead
Py_DEPRECATED(3.14) PyAPI_FUNC(PyObject *) _PyDict_GetItemStringWithError(PyObject *, const char *);
Copy link
Member

Choose a reason for hiding this comment

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

Maybe 3.13?

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't like adding new compiler warnings after beta1. There is no urgency to remove it.

@serhiy-storchaka
Copy link
Member

_PyDict_GetItemStringWithError() is just a wrapper around PyDict_GetItemWithError(). There are no reasons of using it instead of your own wrapper around PyDict_GetItemWithError().

@vstinner
Copy link
Member Author

vstinner commented Jun 1, 2024

numpy and other projects used it. numpy was updated to use PyDict_GetItemStringRef() using pythoncapi-compat.

@vstinner vstinner merged commit 70934fb into python:main Jun 3, 2024
@vstinner vstinner deleted the depr_pydict_witherr branch June 3, 2024 08:26
noahbkim pushed a commit to hudson-trading/cpython that referenced this pull request Jul 11, 2024
JukkaL pushed a commit to python/mypy that referenced this pull request Oct 16, 2024
`_PyDict_GetItemStringWithError ` was deprecated for Python 3.14 in
python/cpython#119855.
Use `PyDict_GetItemStringRef` instead. It was added in 3.13 but is
available via `pythoncapi_compat.h`.

https://docs.python.org/3/c-api/dict.html#c.PyDict_GetItemStringRef
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants