Skip to content

Commit 7b65591

Browse files
committed
use PyUFunc_GiveFloatingpointErrors
1 parent 0429656 commit 7b65591

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

stringdtype/stringdtype/src/casts.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -779,12 +779,10 @@ string_to_pyfloat(char *in)
779779
npy_##typename fval = (double_to_float)(dval); \
780780
\
781781
if (NPY_UNLIKELY(isinf_name(fval) && !(npy_isinf(dval)))) { \
782-
/* we need to somehow use numpy's floating point error */ \
783-
/* handling, which supports lots more functionality but */ \
784-
/* isn't exposed in the C API */ \
785-
PyErr_SetString(PyExc_FloatingPointError, \
786-
"overflow encountered in cast"); \
787-
return -1; \
782+
if (PyUFunc_GiveFloatingpointErrors("cast", \
783+
NPY_FPE_OVERFLOW) < 0) { \
784+
return -1; \
785+
} \
788786
} \
789787
\
790788
*out = fval; \

stringdtype/stringdtype/src/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ PyInit__main(void)
9292
if (_import_array() < 0) {
9393
return NULL;
9494
}
95-
if (import_experimental_dtype_api(12) < 0) {
95+
if (import_experimental_dtype_api(13) < 0) {
9696
return NULL;
9797
}
9898

0 commit comments

Comments
 (0)