* @brief Shim for `_PyErr_SetKeyError`. * Since Python 3.13, `_PyErr_SetKeyError` function became an internal API. */
| 98 | * Since Python 3.13, `_PyErr_SetKeyError` function became an internal API. |
| 99 | */ |
| 100 | inline void PyErr_SetKeyError(PyObject *key) { |
| 101 | // Use the provided API when possible, as `PyErr_SetObject`'s behaviour is more complex than originally thought |
| 102 | // see also: https://github.com/python/cpython/issues/101578 |
| 103 | #if PY_VERSION_HEX < 0x030d0000 // Python version is lower than 3.13 |
| 104 | return _PyErr_SetKeyError(key); |
| 105 | #else |
| 106 | return PyErr_SetObject(PyExc_KeyError, key); |
| 107 | #endif |
| 108 | } |
| 109 | |
| 110 | /** |
| 111 | * @brief Shim for `Py_SET_SIZE`. |
no outgoing calls
no test coverage detected