MCPcopy Create free account
hub / github.com/pybind/pybind11 / dict_getitemstring

Function dict_getitemstring

include/pybind11/pytypes.h:976–989  ·  view source on GitHub ↗

copied from cpython _PyDict_GetItemStringWithError

Source from the content-addressed store, hash-verified

974
975// copied from cpython _PyDict_GetItemStringWithError
976inline PyObject *dict_getitemstring(PyObject *v, const char *key) {
977 PyObject *kv = nullptr, *rv = nullptr;
978 kv = PyUnicode_FromString(key);
979 if (kv == nullptr) {
980 throw error_already_set();
981 }
982
983 rv = PyDict_GetItemWithError(v, kv);
984 Py_DECREF(kv);
985 if (rv == nullptr && PyErr_Occurred()) {
986 throw error_already_set();
987 }
988 return rv;
989}
990
991inline PyObject *dict_getitem(PyObject *v, PyObject *key) {
992 PyObject *rv = PyDict_GetItemWithError(v, key);

Callers 4

dict_getitemstringrefFunction · 0.85
get_internals_capsuleFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected