Skip to content

Commit f8ed6c0

Browse files
committed
Fix support for numpy v1.x
1 parent 0778497 commit f8ed6c0

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/uproot/writing/_cascadetree.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -548,12 +548,20 @@ def extend(self, file, sink, data):
548548
try:
549549
with warnings.catch_warnings():
550550
warnings.simplefilter(
551-
"error", category=numpy.VisibleDeprecationWarning
551+
"error",
552+
category=getattr(
553+
numpy, "exceptions", numpy
554+
).VisibleDeprecationWarning,
552555
)
553556
v = numpy.array(v) # noqa: PLW2901 (overwriting v)
554557
if v.dtype == numpy.dtype("O"):
555558
raise Exception
556-
except (numpy.VisibleDeprecationWarning, Exception):
559+
except (
560+
getattr(
561+
numpy, "exceptions", numpy
562+
).VisibleDeprecationWarning,
563+
Exception,
564+
):
557565
try:
558566
awkward = uproot.extras.awkward()
559567
except ModuleNotFoundError as err:

0 commit comments

Comments
 (0)