Skip to content

Commit 212804a

Browse files
fix: prevent openmp compilation on pyodide
1 parent 3e8c1e4 commit 212804a

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

pandas/_libs/algos.pyx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
cimport cython
22
from cython cimport Py_ssize_t
33
from cython.parallel cimport prange
4+
import sys
45
from libc.math cimport (
56
fabs,
67
sqrt,
@@ -367,9 +368,10 @@ def nancorr(
367368
float64_t mean, ssqd, val
368369
float64_t vx, vy, dx, dy, meanx, meany, divisor, ssqdmx, ssqdmy, covxy, corr_val
369370

370-
# Disable parallel execution in Pyodide/WebAssembly environment
371-
if use_parallel and hasattr(sys, "platform") and sys.platform == "emscripten":
372-
use_parallel = False
371+
# Disable parallel execution in WASM/Emscripten environments
372+
if use_parallel and hasattr(sys, "platform"):
373+
if "emscripten" in sys.platform or "wasm32" in sys.platform:
374+
use_parallel = False
373375

374376
N, K = (<object>mat).shape
375377
if minp is None:
@@ -398,7 +400,6 @@ def nancorr(
398400
ssqds[j] = ssqd
399401

400402
if use_parallel:
401-
# Use parallel execution with prange (only works if OpenMP is available)
402403
for xi in prange(K, schedule="dynamic", nogil=True):
403404
for yi in range(xi + 1):
404405
covxy = 0

0 commit comments

Comments
 (0)