Skip to content

Commit e05b248

Browse files
authored
Merge pull request #19507 from neutrinoceros/compat/support-np2_5-ufuncs
BUG: add support for new internal ufuncs in numpy 2.5 (`np._core.imag` and `np._core.real`)
2 parents 1f61c8f + 223bf86 commit e05b248

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

astropy/units/quantity_helper/helpers.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
NUMPY_LT_2_1,
1919
NUMPY_LT_2_2,
2020
NUMPY_LT_2_3,
21+
NUMPY_LT_2_5,
2122
)
2223

2324
from . import UFUNC_HELPERS, UNSUPPORTED_UFUNCS
@@ -454,6 +455,9 @@ def helper_clip(f, unit1, unit2, unit3):
454455
np.trunc,
455456
np.positive,
456457
)
458+
if not NUMPY_LT_2_5:
459+
invariant_ufuncs += (np_umath.imag, np_umath.real)
460+
457461
for ufunc in invariant_ufuncs:
458462
UFUNC_HELPERS[ufunc] = helper_invariant
459463

0 commit comments

Comments
 (0)