Restore the removed _PyDict_GetItemStringWithError() function. It is
used by numpy.
PyAPI_FUNC(PyObject *) _PyDict_GetItem_KnownHash(PyObject *mp, PyObject *key,
Py_hash_t hash);
-
+PyAPI_FUNC(PyObject *) _PyDict_GetItemStringWithError(PyObject *, const char *);
PyAPI_FUNC(PyObject *) PyDict_SetDefault(
PyObject *mp, PyObject *key, PyObject *defaultobj);
--- /dev/null
+Restore the removed ``_PyDict_GetItemStringWithError()`` function. It is
+used by numpy. Patch by Victor Stinner.
return _PyDict_GetItem_KnownHash(dp, kv, hash); // borrowed reference
}
+PyObject *
+_PyDict_GetItemStringWithError(PyObject *v, const char *key)
+{
+ PyObject *kv, *rv;
+ kv = PyUnicode_FromString(key);
+ if (kv == NULL) {
+ return NULL;
+ }
+ rv = PyDict_GetItemWithError(v, kv);
+ Py_DECREF(kv);
+ return rv;
+}
+
+
/* Fast version of global value lookup (LOAD_GLOBAL).
* Lookup in globals, then builtins.
*