Skip to content

Commit

Permalink
Merge pull request astropy#14864 from mhvk/units-numpy-dev-linalg
Browse files Browse the repository at this point in the history
Ensure np.linalg overrides continue to work with numpy >= 1.25
  • Loading branch information
pllim committed May 24, 2023
2 parents 399383a + 01d22f0 commit cf34e78
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion astropy/units/quantity.py
Original file line number Diff line number Diff line change
Expand Up @@ -716,7 +716,10 @@ def _result_as_quantity(self, result, unit, out):
if isinstance(result, (tuple, list)):
if out is None:
out = (None,) * len(result)
return result.__class__(
# Some np.linalg functions return namedtuple, which is handy to access
# elements by name, but cannot be directly initialized with an iterator.
result_cls = getattr(result, "_make", result.__class__)
return result_cls(
self._result_as_quantity(result_, unit_, out_)
for (result_, unit_, out_) in zip(result, unit, out)
)
Expand Down

0 comments on commit cf34e78

Please sign in to comment.