Warn that numba may not work on non-x86
authorDebian Science Team <debian-science-maintainers@lists.alioth.debian.org>
Sun, 21 Apr 2024 12:50:13 +0000 (13:50 +0100)
committerRebecca N. Palmer <rebecca_palmer@zoho.com>
Sun, 21 Apr 2024 12:50:13 +0000 (13:50 +0100)
Currently known issues are crashes, not wrong answers, but because
the test setup doesn't allow ignoring crashes but failing on
wrong answers, it would be easy to not notice if this changed

Author: Rebecca N. Palmer <rebecca_palmer@zoho.com>
Forwarded: no

Gbp-Pq: Name numba_warn_nonx86.patch

pandas/compat/_optional.py

index c5792fa1379fe7d5a316966b4068fb43a6fef65c..a25ab9635e5a04c997d133169773825a21cc2cdc 100644 (file)
@@ -4,6 +4,9 @@ import importlib
 import sys
 from typing import TYPE_CHECKING
 import warnings
+import platform
+import re
+warn_numba_platform = "Non-x86 system detected, Numba may give wrong results or crash" if not bool(re.match('i.?86|x86',platform.uname()[4])) else False
 
 from pandas.util._exceptions import find_stack_level
 
@@ -120,6 +123,8 @@ def import_optional_dependency(
     """
 
     assert errors in {"warn", "raise", "ignore"}
+    if name=='numba' and warn_numba_platform:
+        warnings.warn(warn_numba_platform)
 
     package_name = INSTALL_MAPPING.get(name)
     install_name = package_name if package_name is not None else name