Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 7f95a26

Browse filesBrowse files
authored
Merge pull request #26452 from mtsokol/update-np-exceptions-imports
ENH: Update numpy exceptions imports
2 parents d073a36 + ec3213b commit 7f95a26
Copy full SHA for 7f95a26

File tree

Expand file treeCollapse file tree

1 file changed

+7
-2
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+7
-2
lines changed

‎lib/matplotlib/cbook.py

Copy file name to clipboardExpand all lines: lib/matplotlib/cbook.py
+7-2Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@
2323

2424
import numpy as np
2525

26+
try:
27+
from numpy.exceptions import VisibleDeprecationWarning # numpy >= 1.25
28+
except ImportError:
29+
from numpy import VisibleDeprecationWarning
30+
2631
import matplotlib
2732
from matplotlib import _api, _c_internal_utils
2833

@@ -1064,7 +1069,7 @@ def _combine_masks(*args):
10641069
raise ValueError("Masked arrays must be 1-D")
10651070
try:
10661071
x = np.asanyarray(x)
1067-
except (np.VisibleDeprecationWarning, ValueError):
1072+
except (VisibleDeprecationWarning, ValueError):
10681073
# NumPy 1.19 raises a warning about ragged arrays, but we want
10691074
# to accept basically anything here.
10701075
x = np.asanyarray(x, dtype=object)
@@ -1658,7 +1663,7 @@ def index_of(y):
16581663
pass
16591664
try:
16601665
y = _check_1d(y)
1661-
except (np.VisibleDeprecationWarning, ValueError):
1666+
except (VisibleDeprecationWarning, ValueError):
16621667
# NumPy 1.19 will warn on ragged input, and we can't actually use it.
16631668
pass
16641669
else:

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.