gh-112026: Deprecate _PyDict_GetItemStringWithError() function by vstinner · Pull Request #119855 · python/cpython

@vstinner

@vstinner

@vstinner

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

@vstinner

serhiy-storchaka

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 *);

Choose a reason for hiding this comment

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

Maybe 3.13?

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

@serhiy-storchaka

_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

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

mliezun pushed a commit to mliezun/cpython that referenced this pull request

Jun 3, 2024

barneygale pushed a commit to barneygale/cpython that referenced this pull request

Jun 5, 2024

noahbkim pushed a commit to hudson-trading/cpython that referenced this pull request

Jul 11, 2024

estyxx pushed a commit to estyxx/cpython that referenced this pull request

Jul 17, 2024

JukkaL pushed a commit to python/mypy that referenced this pull request

Oct 16, 2024