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

Skip to content

Commit 314edc6

Browse files
authored
Merge pull request #26455 from meeseeksmachine/auto-backport-of-pr-26452-on-v3.7.x
Backport PR #26452 on branch v3.7.x (ENH: Update numpy exceptions imports)
2 parents eb4b1ee + a5c480d commit 314edc6

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

lib/matplotlib/cbook/__init__.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@
2626

2727
import numpy as np
2828

29+
try:
30+
from numpy.exceptions import VisibleDeprecationWarning # numpy >= 1.25
31+
except ImportError:
32+
from numpy import VisibleDeprecationWarning
33+
2934
import matplotlib
3035
from matplotlib import _api, _c_internal_utils
3136

@@ -1065,7 +1070,7 @@ def _combine_masks(*args):
10651070
raise ValueError("Masked arrays must be 1-D")
10661071
try:
10671072
x = np.asanyarray(x)
1068-
except (np.VisibleDeprecationWarning, ValueError):
1073+
except (VisibleDeprecationWarning, ValueError):
10691074
# NumPy 1.19 raises a warning about ragged arrays, but we want
10701075
# to accept basically anything here.
10711076
x = np.asanyarray(x, dtype=object)
@@ -1659,7 +1664,7 @@ def index_of(y):
16591664
pass
16601665
try:
16611666
y = _check_1d(y)
1662-
except (np.VisibleDeprecationWarning, ValueError):
1667+
except (VisibleDeprecationWarning, ValueError):
16631668
# NumPy 1.19 will warn on ragged input, and we can't actually use it.
16641669
pass
16651670
else:

0 commit comments

Comments
 (0)