8000 Merge pull request #24337 from charris/backport-24238 · numpy/numpy@6ee37b0 · GitHub
[go: up one dir, main page]

Skip to content

Commit 6ee37b0

Browse files
authored
Merge pull request #24337 from charris/backport-24238
TST: fix running the test suite in builds without BLAS/LAPACK
2 parents baf6250 + b2489f2 commit 6ee37b0

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

numpy/linalg/tests/test_linalg.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,13 @@
2121
assert_almost_equal, assert_allclose, suppress_warnings,
2222
assert_raises_regex, HAS_LAPACK64, IS_WASM
2323
)
24+
try:
25+
import numpy.linalg.lapack_lite
26+
except ImportError:
27+
# May be broken when numpy was built without BLAS/LAPACK present
28+
# If so, ensure we don't break the whole test suite - the `lapack_lite`
29+
# submodule should be removed, it's only used in two tests in this file.
30+
pass
2431

2532

2633
def consistent_subclass(out, in_):

numpy/linalg/umath_linalg.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4597,5 +4597,11 @@ PyMODINIT_FUNC PyInit__umath_linalg(void)
45974597
return NULL;
45984598
}
45994599

4600+
#ifdef HAVE_BLAS_ILP64
4601+
PyDict_SetItemString(d, "_ilp64", Py_True);
4602+
#else
4603+
PyDict_SetItemString(d, "_ilp64", Py_False);
4604+
#endif
4605+
46004606
return m;
46014607
}

numpy/testing/_private/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
from numpy.core import (
2323
intp, float32, empty, arange, array_repr, ndarray, isnat, array)
2424
from numpy import isfinite, isnan, isinf
25-
import numpy.linalg.lapack_lite
25+
import numpy.linalg._umath_linalg
2626

2727
from io import StringIO
2828

@@ -54,7 +54,7 @@ class KnownFailureException(Exception):
5454
IS_PYPY = sys.implementation.name == 'pypy'
5555
IS_PYSTON = hasattr(sys, "pyston_version_info")
5656
HAS_REFCOUNT = getattr(sys, 'getrefcount', None) is not None and not IS_PYSTON
57-
HAS_LAPACK64 = numpy.linalg.lapack_lite._ilp64
57+
HAS_LAPACK64 = numpy 48AC .linalg._umath_linalg._ilp64
5858

5959
_OLD_PROMOTION = lambda: np._get_promotion_state() == 'legacy'
6060

0 commit comments

Comments
 (0)
0