Skip to content

Commit 3d0c477

Browse files
committed
work around OSX math undefs
1 parent ae2b484 commit 3d0c477

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

doc/source/whatsnew/v0.23.4.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ and bug fixes. We recommend that all users upgrade to this version.
1616
Fixed Regressions
1717
~~~~~~~~~~~~~~~~~
1818

19-
-
19+
- Python 3.7 with Windows gave all missing values for rolling variance calculations (:issue:`21813`)
2020
-
2121

2222
.. _whatsnew_0234.bug_fixes:

pandas/_libs/src/headers/cmath

Lines changed: 1 addition & 0 deletions
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

Lines changed: 3 additions & 5 deletions
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

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

664662
nobs[0] = nobs[0] + 1

0 commit comments

Comments
 (0)