Skip to content

Commit

Permalink
MNT: Work-around cumprod and friends for numpy>=2
Browse files Browse the repository at this point in the history
These were removed in numpy>=2, so just suppress the AttributeError in
the event that these are not available.
  • Loading branch information
dopplershift committed Apr 26, 2024
1 parent f2e4081 commit 03fc7e1
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pint/facets/numpy/numpy_func.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from __future__ import annotations

import warnings
from contextlib import suppress
from inspect import signature
from itertools import chain

Expand Down Expand Up @@ -966,7 +967,9 @@ def implementation(a, *args, **kwargs):


for func_str in ("cumprod", "nancumprod"):
implement_single_dimensionless_argument_func(func_str)
# These functions were removed in later numpy versions
with suppress(AttributeError):
implement_single_dimensionless_argument_func(func_str)

# Handle single-argument consistent unit functions
for func_str in (
Expand Down

0 comments on commit 03fc7e1

Please sign in to comment.