| 169 | |
| 170 | |
| 171 | static int |
| 172 | copy_positional_args_to_kwargs(const char **keywords, |
| 173 | PyObject *const *args, Py_ssize_t len_args, |
| 174 | PyObject *normal_kwds) |
| 175 | { |
| 176 | for (Py_ssize_t i = 0; i < len_args; i++) { |
| 177 | if (keywords[i] == NULL) { |
| 178 | /* keyword argument is either input or output and not set here */ |
| 179 | continue; |
| 180 | } |
| 181 | if (NPY_UNLIKELY(i == 5)) { |
| 182 | /* |
| 183 | * This is only relevant for reduce, which is the only one with |
| 184 | * 5 keyword arguments. |
| 185 | */ |
| 186 | static PyObject *NoValue = NULL; |
| 187 | assert(strcmp(keywords[i], "initial") == 0); |
| 188 | npy_cache_import("numpy", "_NoValue", &NoValue); |
| 189 | if (args[i] == NoValue) { |
| 190 | continue; |
| 191 | } |
| 192 | } |
| 193 | |
| 194 | int res = PyDict_SetItemString(normal_kwds, keywords[i], args[i]); |
| 195 | if (res < 0) { |
| 196 | return -1; |
| 197 | } |
| 198 | } |
| 199 | return 0; |
| 200 | } |
| 201 | |
| 202 | /* |
| 203 | * Check a set of args for the `__array_ufunc__` method. If more than one of |
no test coverage detected