gh-112026: Deprecate _PyDict_GetItemStringWithError() function by vstinner · Pull Request #119855 · python/cpython
Conversation
The function was removed in Python 3.13 alpha1 and added back to Python 3.13 alpha2 by #112119.
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.
_PyDict_GetItemStringWithError() is just a wrapper around PyDict_GetItemWithError(). There are no reasons of using it instead of your own wrapper around PyDict_GetItemWithError().
numpy and other projects used it. numpy was updated to use PyDict_GetItemStringRef() using pythoncapi-compat.