mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
gh-112026: Restore removed _PyDict_GetItemStringWithError() (#112119)
Restore the removed _PyDict_GetItemStringWithError() function. It is used by numpy.
This commit is contained in:
parent
ec05507367
commit
bd2f1485b0
3 changed files with 17 additions and 1 deletions
|
@ -1842,6 +1842,20 @@ _PyDict_GetItemIdWithError(PyObject *dp, _Py_Identifier *key)
|
|||
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.
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue