MCPcopy Create free account
hub / github.com/MagicStack/asyncpg / PyDict_GetItemRef

Function PyDict_GetItemRef

asyncpg/protocol/record/pythoncapi_compat.h:815–833  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

813// to Python 3.13.0a1
814#if PY_VERSION_HEX < 0x030D00A1
815static inline int
816PyDict_GetItemRef(PyObject *mp, PyObject *key, PyObject **result)
817{
818#if PY_VERSION_HEX >= 0x03000000
819 PyObject *item = PyDict_GetItemWithError(mp, key);
820#else
821 PyObject *item = _PyDict_GetItemWithError(mp, key);
822#endif
823 if (item != NULL) {
824 *result = Py_NewRef(item);
825 return 1; // found
826 }
827 if (!PyErr_Occurred()) {
828 *result = NULL;
829 return 0; // not found
830 }
831 *result = NULL;
832 return -1;
833}
834
835static inline int
836PyDict_GetItemStringRef(PyObject *mp, const char *key, PyObject **result)

Callers 2

PyDict_GetItemStringRefFunction · 0.85
PyDict_SetDefaultRefFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected