* Check casting: It would be nice to just move this into the iterator * or pass in the full cast information. But this can special case * the logical functions and prints a better error message. */
| 1421 | * the logical functions and prints a better error message. |
| 1422 | */ |
| 1423 | static inline int |
| 1424 | validate_casting(PyArrayMethodObject *method, PyUFuncObject *ufunc, |
| 1425 | PyArrayObject *ops[], PyArray_Descr *descriptors[], |
| 1426 | NPY_CASTING casting) |
| 1427 | { |
| 1428 | if (method->resolve_descriptors == &wrapped_legacy_resolve_descriptors) { |
| 1429 | /* |
| 1430 | * In this case the legacy type resolution was definitely called |
| 1431 | * and we do not need to check (astropy/pyerfa relied on this). |
| 1432 | */ |
| 1433 | return 0; |
| 1434 | } |
| 1435 | if (method->flags & _NPY_METH_FORCE_CAST_INPUTS) { |
| 1436 | if (PyUFunc_ValidateOutCasting(ufunc, casting, ops, descriptors) < 0) { |
| 1437 | return -1; |
| 1438 | } |
| 1439 | } |
| 1440 | else { |
| 1441 | if (PyUFunc_ValidateCasting(ufunc, casting, ops, descriptors) < 0) { |
| 1442 | return -1; |
| 1443 | } |
| 1444 | } |
| 1445 | return 0; |
| 1446 | } |
| 1447 | |
| 1448 | |
| 1449 | /* |
no test coverage detected