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 af9d6eb

Browse filesBrowse 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 ab6d338 commit af9d6eb
Copy full SHA for af9d6eb

File tree

Expand file treeCollapse file tree

1 file changed

+1
-1
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+1
-1
lines changed

‎lib/matplotlib/dates.py

Copy file name to clipboardExpand all lines: lib/matplotlib/dates.py
+1-1Lines 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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.