Skip to content

Commit

Permalink
BLD: fix building against numpy dev
Browse files Browse the repository at this point in the history
  • Loading branch information
neutrinoceros committed Mar 8, 2024
1 parent 7847a2f commit 5250b4b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions erfa/ufunc.c.templ
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ ufunc_loop_matches(PyUFuncObject *self,
*/
if (types[i] == NPY_VOID && dtypes != NULL) {
int op_descr_type_num = op_descr->type_num;
int dtype_elsize = dtypes[i]->elsize;
int dtype_elsize = PyDataType_ELSIZE(dtypes[i]);
/*
* MHvK: we do our own check on casting, since by default
* all items can cast to structured dtypes (see gh-11114),
Expand All @@ -391,12 +391,12 @@ ufunc_loop_matches(PyUFuncObject *self,
return 0;
}
}
else if (dtypes[i]->elsize == 1 || dtypes[i]->elsize == 12) {
else if (dtype_elsize == 1 || dtype_elsize == 12) {
/* string structured array; string argument is OK */
if (!((op_descr_type_num == NPY_STRING &&
op_descr->elsize <= dtype_elsize) ||
PyDataType_ELSIZE(op_descr) <= dtype_elsize) ||
(op_descr_type_num == NPY_UNICODE &&
op_descr->elsize >> 2 <= dtype_elsize))) {
PyDataType_ELSIZE(op_descr) >> 2 <= dtype_elsize))) {
return 0;
}
}
Expand Down

0 comments on commit 5250b4b

Please sign in to comment.