Skip to content

Commit a403d27

Browse files
committed
skip test_replace_regex_inplace_refs for numpy 2.2 and ft
1 parent 9fe5614 commit a403d27

File tree

6 files changed

+19
-2
lines changed

6 files changed

+19
-2
lines changed

.github/workflows/unit-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ jobs:
387387
- name: Build Environment
388388
run: |
389389
python --version
390-
python -m pip install --upgrade pip setuptools wheel numpy==2.1 meson[ninja]==1.2.1 meson-python==0.13.1
390+
python -m pip install --upgrade pip setuptools wheel numpy meson[ninja]==1.2.1 meson-python==0.13.1
391391
python -m pip install --pre --extra-index-url https://pypi.anaconda.org/scientific-python-nightly-wheels/simple cython
392392
python -m pip install versioneer[toml]
393393
python -m pip install python-dateutil pytz tzdata hypothesis>=6.84.0 pytest>=7.3.2 pytest-xdist>=3.4.0 pytest-cov

pandas/compat/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,11 @@
1717

1818
from pandas.compat._constants import (
1919
IS64,
20+
IS_FREE_THREADING,
2021
ISMUSL,
2122
PY311,
2223
PY312,
24+
PY313,
2325
PYPY,
2426
WASM,
2527
)
@@ -153,8 +155,10 @@ def is_ci_environment() -> bool:
153155
"HAS_PYARROW",
154156
"IS64",
155157
"ISMUSL",
158+
"IS_FREE_THREADING",
156159
"PY311",
157160
"PY312",
161+
"PY313",
158162
"PYPY",
159163
"WASM",
160164
"is_numpy_dev",

pandas/compat/_constants.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,20 @@
1515

1616
PY311 = sys.version_info >= (3, 11)
1717
PY312 = sys.version_info >= (3, 12)
18+
PY313 = sys.version_info >= (3, 13)
1819
PYPY = platform.python_implementation() == "PyPy"
1920
WASM = (sys.platform == "emscripten") or (platform.machine() in ["wasm32", "wasm64"])
21+
IS_FREE_THREADING = False if not PY313 else sys._is_gil_enabled()
2022
ISMUSL = "musl" in (sysconfig.get_config_var("HOST_GNU_TYPE") or "")
2123
REF_COUNT = 2 if PY311 else 3
2224

2325
__all__ = [
2426
"IS64",
2527
"ISMUSL",
28+
"IS_FREE_THREADING",
2629
"PY311",
2730
"PY312",
31+
"PY313",
2832
"PYPY",
2933
"WASM",
3034
]

pandas/compat/numpy/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
np_version_gte1p24p3 = _nlv >= Version("1.24.3")
1414
np_version_gte1p25 = _nlv >= Version("1.25")
1515
np_version_gt2 = _nlv >= Version("2.0.0")
16+
np_version_gt2p2 = _nlv >= Version("2.2.0")
1617
is_numpy_dev = _nlv.dev is not None
1718
_min_numpy_ver = "1.23.5"
1819

pandas/tests/copy_view/test_replace.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import numpy as np
22
import pytest
33

4+
from pandas.compat import IS_FREE_THREADING
5+
from pandas.compat.numpy import np_version_gt2p2
6+
47
from pandas import (
58
Categorical,
69
DataFrame,
@@ -45,6 +48,10 @@ def test_replace(replace_kwargs):
4548
tm.assert_frame_equal(df, df_orig)
4649

4750

51+
@pytest.mark.skipif(
52+
IS_FREE_THREADING and np_version_gt2p2,
53+
reason="Segfaults in array_algos.replace.replace_regex",
54+
)
4855
def test_replace_regex_inplace_refs():
4956
df = DataFrame({"a": ["aaa", "bbb"]})
5057
df_orig = df.copy()

scripts/validate_unwanted_patterns.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,8 @@ def _get_literal_string_prefix_len(token_string: str) -> int:
8989
return 0
9090

9191

92-
PRIVATE_FUNCTIONS_ALLOWED = {"sys._getframe"} # no known alternative
92+
# no known alternative
93+
PRIVATE_FUNCTIONS_ALLOWED = {"sys._getframe", "sys._is_gil_enabled"}
9394

9495

9596
def private_function_across_module(file_obj: IO[str]) -> Iterable[tuple[int, str]]:

0 commit comments

Comments
 (0)