Skip to content

Commit 0c89e2a

Browse files
Debian Science Teamrebecca-palmer
Debian Science Team
authored andcommitted
Allow some numba errors on 32-bit
Specifying the exception type allows only explicit errors, not silently wrong answers Author: Rebecca N. Palmer <[email protected]> Forwarded: no Gbp-Pq: Name numba_fail_32bit.patch
1 parent 3efd46a commit 0c89e2a

File tree

4 files changed

+79
-2
lines changed

4 files changed

+79
-2
lines changed

pandas/tests/groupby/aggregate/test_numba.py

+12
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@
1111
option_context,
1212
)
1313
import pandas._testing as tm
14+
from pandas.compat import IS64
15+
try:
16+
from numba.core.errors import UnsupportedParforsError, TypingError
17+
except ImportError: # numba not installed
18+
UnsupportedParforsError = ImportError
19+
TypingError = ImportError
1420

1521
pytestmark = pytest.mark.single_cpu
1622

@@ -252,6 +258,12 @@ def test_multifunc_numba_vs_cython_series(agg_kwargs):
252258
),
253259
],
254260
)
261+
@pytest.mark.xfail(
262+
condition=not IS64,
263+
reason="parfors not available on 32-bit",
264+
raises=UnsupportedParforsError,
265+
strict=False,
266+
)
255267
def test_multifunc_numba_kwarg_propagation(data, agg_kwargs):
256268
pytest.importorskip("numba")
257269
labels = ["a", "a", "b", "b", "a"]

pandas/tests/groupby/conftest.py

+21-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@
1111
reduction_kernels,
1212
transformation_kernels,
1313
)
14+
from pandas.compat import IS64
15+
try:
16+
from numba.core.errors import UnsupportedParforsError
17+
except ImportError: # numba not installed
18+
UnsupportedParforsError = ImportError
1419

1520

1621
@pytest.fixture(params=[True, False])
@@ -153,7 +158,22 @@ def groupby_func(request):
153158
return request.param
154159

155160

156-
@pytest.fixture(params=[True, False])
161+
# the xfail is because numba does not support this on 32-bit systems
162+
# https://github.com/numba/numba/blob/main/numba/parfors/parfors.py
163+
# strict=False because some tests are of error paths that
164+
# fail of something else before reaching this point
165+
@pytest.fixture(params=[
166+
pytest.param(
167+
True,
168+
marks=pytest.mark.xfail(
169+
condition=not IS64,
170+
reason="parfors not available on 32-bit",
171+
raises=UnsupportedParforsError,
172+
strict=False,
173+
)
174+
),
175+
False,
176+
])
157177
def parallel(request):
158178
"""parallel keyword argument for numba.jit"""
159179
return request.param

pandas/tests/window/conftest.py

+22-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@
1313
Series,
1414
bdate_range,
1515
)
16+
from pandas.compat import IS64
17+
try:
18+
from numba.core.errors import UnsupportedParforsError, TypingError
19+
except ImportError: # numba not installed
20+
UnsupportedParforsError = ImportError
21+
TypingError = ImportError
1622

1723

1824
@pytest.fixture(params=[True, False])
@@ -50,7 +56,22 @@ def min_periods(request):
5056
return request.param
5157

5258

53-
@pytest.fixture(params=[True, False])
59+
# the xfail is because numba does not support this on 32-bit systems
60+
# https://github.com/numba/numba/blob/main/numba/parfors/parfors.py
61+
# strict=False because some tests are of error paths that
62+
# fail of something else before reaching this point
63+
@pytest.fixture(params=[
64+
pytest.param(
65+
True,
66+
marks=pytest.mark.xfail(
67+
condition=not IS64,
68+
reason="parfors not available on 32-bit",
69+
raises=(UnsupportedParforsError, TypingError),
70+
strict=False,
71+
)
72+
),
73+
False,
74+
])
5475
def parallel(request):
5576
"""parallel keyword argument for numba.jit"""
5677
return request.param

pandas/tests/window/test_numba.py

+24
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
import numpy as np
22
import pytest
33

4+
from pandas.compat import IS64
5+
try:
6+
from numba.core.errors import UnsupportedParforsError, TypingError
7+
except ImportError: # numba not installed
8+
UnsupportedParforsError = ImportError
9+
TypingError = ImportError
410
from pandas.errors import NumbaUtilError
511
import pandas.util._test_decorators as td
612

@@ -186,6 +192,12 @@ def add(values, x):
186192
expected = DataFrame({"value": [2.0, 2.0, 2.0]})
187193
tm.assert_frame_equal(result, expected)
188194

195+
@pytest.mark.xfail(
196+
condition=not IS64,
197+
reason="parfors not available on 32-bit",
198+
raises=UnsupportedParforsError,
199+
strict=False,
200+
)
189201
def test_dont_cache_engine_kwargs(self):
190202
# If the user passes a different set of engine_kwargs don't return the same
191203
# jitted function
@@ -326,6 +338,12 @@ def f(x):
326338
f, engine="numba", raw=True
327339
)
328340

341+
@pytest.mark.xfail(
342+
condition=not IS64,
343+
reason="parfors not available on 32-bit",
344+
raises=(UnsupportedParforsError, TypingError),
345+
strict=False,
346+
)
329347
def test_table_method_rolling_methods(
330348
self,
331349
axis,
@@ -408,6 +426,12 @@ def f(x):
408426
)
409427
tm.assert_frame_equal(result, expected)
410428

429+
@pytest.mark.xfail(
430+
condition=not IS64,
431+
reason="parfors not available on 32-bit",
432+
raises=(UnsupportedParforsError, TypingError),
433+
strict=False,
434+
)
411435
def test_table_method_expanding_methods(
412436
self, axis, nogil, parallel, nopython, arithmetic_numba_supported_operators
413437
):

0 commit comments

Comments
 (0)