Skip to content

Commit

Permalink
Don't let _join_pairs raise StopIteration
Browse files Browse the repository at this point in the history
Python 3.5+ doesn't like that anymore.

I'm actually a bit surprised that this new code works; is it guaranteed to work
on all Python implementations?  I guess I'll find out.
  • Loading branch information
jwodder committed May 23, 2017
1 parent bbcb8be commit 6b60141
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions linesep.py
Expand Up @@ -256,8 +256,7 @@ def _join_pairs(iterable):
unmodified.
"""
i = iter(iterable)
while True:
a = next(i)
for a in i:
try:
b = next(i)
except StopIteration:
Expand Down

0 comments on commit 6b60141

Please sign in to comment.