Skip to content

Commit 87e69e8

Browse files
committed
work around OSX math undefs
1 parent ff2f389 commit 87e69e8

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

doc/source/whatsnew/v0.23.4.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ and bug fixes. We recommend that all users upgrade to this version.
2020
Fixed Regressions
2121
~~~~~~~~~~~~~~~~~
2222

23-
-
23+
- Python 3.7 with Windows gave all missing values for rolling variance calculations (:issue:`21813`)
2424
-
2525

2626
.. _whatsnew_0234.bug_fixes:

pandas/_libs/src/headers/cmath

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#if defined(_MSC_VER) && (_MSC_VER < 1800)
77
#include <cmath>
88
namespace std {
9+
#define isnan(x) _isnan(x)
910
__inline int signbit(double num) { return _copysign(1.0, num) < 0; }
1011
}
1112
#else

pandas/_libs/window.pyx

+3-5
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,10 @@ cnp.import_array()
1414

1515

1616
cdef extern from "src/headers/cmath" namespace "std":
17+
bint isnan(double) nogil
1718
int signbit(double) nogil
1819
double sqrt(double x) nogil
1920

20-
cdef extern from "numpy/npy_math.h":
21-
bint npy_isnan(double) nogil
22-
2321
cimport util
2422
from util cimport numeric
2523

@@ -656,8 +654,8 @@ cdef inline void add_var(const double val, double *nobs, double *mean_x,
656654
double *ssqdm_x) nogil:
657655
""" add a value from the var calc """
658656
cdef double delta
659-
# `isnan` instead of equality as fix for GH-21813
660-
if npy_isnan(val):
657+
# `isnan` instead of equality as fix for GH-21813, msvc 2017 bug
658+
if isnan(val):
661659
return
662660

663661
nobs[0] = nobs[0] + 1

0 commit comments

Comments
 (0)