| 215 | */ |
| 216 | |
| 217 | static inline int |
| 218 | NPY_TITLE_KEY_check(PyObject *key, PyObject *value) |
| 219 | { |
| 220 | PyObject *title; |
| 221 | if (PyTuple_Size(value) != 3) { |
| 222 | return 0; |
| 223 | } |
| 224 | title = PyTuple_GetItem(value, 2); |
| 225 | if (key == title) { |
| 226 | return 1; |
| 227 | } |
| 228 | #ifdef PYPY_VERSION |
| 229 | /* |
| 230 | * On PyPy, dictionary keys do not always preserve object identity. |
| 231 | * Fall back to comparison by value. |
| 232 | */ |
| 233 | if (PyUnicode_Check(title) && PyUnicode_Check(key)) { |
| 234 | return PyUnicode_Compare(title, key) == 0 ? 1 : 0; |
| 235 | } |
| 236 | #endif |
| 237 | return 0; |
| 238 | } |
| 239 | |
| 240 | /* Macro, for backward compat with "if NPY_TITLE_KEY(key, value) { ..." */ |
| 241 | #define NPY_TITLE_KEY(key, value) (NPY_TITLE_KEY_check((key), (value))) |
nothing calls this directly
no outgoing calls
no test coverage detected