Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 89313d2

Browse files
authored
Merge pull request #25204 from charris/backport-25146
BUG: fix issues with ``newaxis`` and ``linalg.solve`` in ``numpy.array_api``
2 parents dfa7e0d + fdfbbfb commit 89313d2

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

numpy/array_api/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@
125125

126126
__all__ = ["__array_api_version__"]
127127

128-
from ._constants import e, inf, nan, pi
128+
from ._constants import e, inf, nan, pi, newaxis
129129

130130
__all__ += ["e", "inf", "nan", "pi"]
131131

numpy/array_api/_constants.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@
44
inf = np.inf
55
nan = np.nan
66
pi = np.pi
7+
newaxis = np.newaxis

numpy/array_api/linalg.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -318,8 +318,9 @@ def _solve(a, b):
318318
# This does nothing currently but is left in because it will be relevant
319319
# when complex dtype support is added to the spec in 2022.
320320
signature = 'DD->D' if isComplexType(t) else 'dd->d'
321-
extobj = get_linalg_error_extobj(_raise_linalgerror_singular)
322-
r = gufunc(a, b, signature=signature, extobj=extobj)
321+
with np.errstate(call=_raise_linalgerror_singular, invalid='call',
322+
over='ignore', divide='ignore', under='ignore'):
323+
r = gufunc(a, b, signature=signature)
323324

324325
return wrap(r.astype(result_t, copy=False))
325326

0 commit comments

Comments
 (0)