PyDict_GetItemStringRef was added in Python 3.13.0a1. See also: https://github.com/python/pythoncapi-compat/blob/main/pythoncapi_compat.h
| 999 | // PyDict_GetItemStringRef was added in Python 3.13.0a1. |
| 1000 | // See also: https://github.com/python/pythoncapi-compat/blob/main/pythoncapi_compat.h |
| 1001 | inline PyObject *dict_getitemstringref(PyObject *v, const char *key) { |
| 1002 | #if PY_VERSION_HEX >= 0x030D00A1 |
| 1003 | PyObject *rv = nullptr; |
| 1004 | if (PyDict_GetItemStringRef(v, key, &rv) < 0) { |
| 1005 | throw error_already_set(); |
| 1006 | } |
| 1007 | return rv; |
| 1008 | #else |
| 1009 | PyObject *rv = dict_getitemstring(v, key); |
| 1010 | if (rv == nullptr && PyErr_Occurred()) { |
| 1011 | throw error_already_set(); |
| 1012 | } |
| 1013 | Py_XINCREF(rv); |
| 1014 | return rv; |
| 1015 | #endif |
| 1016 | } |
| 1017 | |
| 1018 | inline PyObject *dict_setdefaultstring(PyObject *v, const char *key, PyObject *defaultobj) { |
| 1019 | PyObject *kv = PyUnicode_FromString(key); |
nothing calls this directly
no test coverage detected