Skip to content

Commit 50b547c

Browse files
committed
MNT: catch correct exceptions
using `next(iter(obj))` can raise `TypeError` if obj is not iterable and `StopIteration` if len(obj) == 0. As we are no longer explictily indexing into `obj` it should not raise an `IndexError`
1 parent fe0cd2f commit 50b547c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/matplotlib/dates.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1562,7 +1562,7 @@ def default_units(x, axis):
15621562

15631563
try:
15641564
x = next(iter(x))
1565-
except (TypeError, IndexError):
1565+
except (TypeError, StopIteration):
15661566
pass
15671567

15681568
try:

0 commit comments

Comments
 (0)