Skip to content

Commit 68cd126

Browse files
Debian Science Teamraspbian-autopush
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 5a39967 commit 68cd126

File tree

4 files changed

+79
-2
lines changed

4 files changed

+79
-2
lines changed

pandas/tests/groupby/aggregate/test_numba.py

Lines changed: 12 additions & 0 deletions
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

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@
77
reduction_kernels,
88
transformation_kernels,
99
)
10+
from pandas.compat import IS64
11+
try:
12+
from numba.core.errors import UnsupportedParforsError
13+
except ImportError: # numba not installed
14+
UnsupportedParforsError = ImportError
1015

1116

1217
@pytest.fixture(params=[True, False])
@@ -169,7 +174,22 @@ def groupby_func(request):
169174
return request.param
170175

171176

172-
@pytest.fixture(params=[True, False])
177+
# the xfail is because numba does not support this on 32-bit systems
178+
# https://github.com/numba/numba/blob/main/numba/parfors/parfors.py
179+
# strict=False because some tests are of error paths that
180+
# fail of something else before reaching this point
181+
@pytest.fixture(params=[
182+
pytest.param(
183+
True,
184+
marks=pytest.mark.xfail(
185+
condition=not IS64,
186+
reason="parfors not available on 32-bit",
187+
raises=UnsupportedParforsError,
188+
strict=False,
189+
)
190+
),
191+
False,
192+
])
173193
def parallel(request):
174194
"""parallel keyword argument for numba.jit"""
175195
return request.param

pandas/tests/window/conftest.py

Lines changed: 22 additions & 1 deletion
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

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,13 @@
55
is_ci_environment,
66
is_platform_mac,
77
is_platform_windows,
8+
IS64,
89
)
10+
try:
11+
from numba.core.errors import UnsupportedParforsError, TypingError
12+
except ImportError: # numba not installed
13+
UnsupportedParforsError = ImportError
14+
TypingError = ImportError
915
from pandas.errors import NumbaUtilError
1016
import pandas.util._test_decorators as td
1117

@@ -199,6 +205,12 @@ def add(values, x):
199205
expected = DataFrame({"value": [2.0, 2.0, 2.0]})
200206
tm.assert_frame_equal(result, expected)
201207

208+
@pytest.mark.xfail(
209+
condition=not IS64,
210+
reason="parfors not available on 32-bit",
211+
raises=UnsupportedParforsError,
212+
strict=False,
213+
)
202214
def test_dont_cache_engine_kwargs(self):
203215
# If the user passes a different set of engine_kwargs don't return the same
204216
# jitted function
@@ -339,6 +351,12 @@ def f(x):
339351
f, engine="numba", raw=True
340352
)
341353

354+
@pytest.mark.xfail(
355+
condition=not IS64,
356+
reason="parfors not available on 32-bit",
357+
raises=(UnsupportedParforsError, TypingError),
358+
strict=False,
359+
)
342360
def test_table_method_rolling_methods(
343361
self,
344362
axis,
@@ -421,6 +439,12 @@ def f(x):
421439
)
422440
tm.assert_frame_equal(result, expected)
423441

442+
@pytest.mark.xfail(
443+
condition=not IS64,
444+
reason="parfors not available on 32-bit",
445+
raises=(UnsupportedParforsError, TypingError),
446+
strict=False,
447+
)
424448
def test_table_method_expanding_methods(
425449
self, axis, nogil, parallel, nopython, arithmetic_numba_supported_operators
426450
):

0 commit comments

Comments
 (0)