Skip to content

Commit 4224757

Browse files
committed
use nogil version of sqrt
1 parent 972cf0d commit 4224757

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

pandas/_libs/algos.pyx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,10 @@ from numpy cimport (ndarray,
2727
cdef double NaN = <double> np.NaN
2828
cdef double nan = NaN
2929

30-
from libc.math cimport sqrt, fabs
30+
from libc.math cimport fabs
31+
cdef extern from "src/headers/math.h":
32+
# use this version instead of `from libc.math cimport sqrt`; see GH#18420
33+
double sqrt(double x) nogil
3134

3235
# this is our util.pxd
3336
from util cimport numeric, get_nat

pandas/_libs/lib.pyx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,10 @@ cdef int64_t NPY_NAT = util.get_nat()
6262
cimport util
6363
from util cimport is_array, _checknull
6464

65-
from libc.math cimport sqrt, fabs
65+
from libc.math cimport fabs
66+
cdef extern from "src/headers/math.h":
67+
# use this version instead of `from libc.math cimport sqrt`; see GH#18420
68+
double sqrt(double x) nogil
6669

6770

6871
def values_from_object(object o):

pandas/_libs/window.pyx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ from util cimport numeric
3737
cdef extern from "../src/headers/math.h":
3838
int signbit(double) nogil
3939
double sqrt(double x) nogil
40+
# use this version instead of `from libc.math cimport sqrt`; see GH#18420
4041

4142

4243
# Cython implementations of rolling sum, mean, variance, skewness,

0 commit comments

Comments
 (0)