Skip to content

Commit ba1bbb6

Browse files
committed
Merge branch 'fix-stopiteration-p37' of 'https://github.com/sduenas/sortinghat'
Merges #506 Closes #506
2 parents ea949a0 + 5846016 commit ba1bbb6

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

sortinghat/core/jobs.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,10 @@ def _iter_split(iterator, size=None):
468468
# This code is based on Ashley Waite's answer to StackOverflow question
469469
# "split a generator/iterable every n items in python (splitEvery)"
470470
# (https://stackoverflow.com/a/44320132).
471-
while True:
472-
slice_iter = itertools.islice(iterator, size)
473-
peek = next(slice_iter)
474-
yield itertools.chain([peek], slice_iter)
471+
try:
472+
while True:
473+
slice_iter = itertools.islice(iterator, size)
474+
peek = next(slice_iter)
475+
yield itertools.chain([peek], slice_iter)
476+
except StopIteration:
477+
return

0 commit comments

Comments
 (0)