Skip to content

Commit

Permalink
Catch StopIteration in AbstractTable._enumerate_items
Browse files Browse the repository at this point in the history
This makes PEP 479 enabled Pythons (such as 3.7) work again.

Otherwise you get:

    RuntimeError: generator raised StopIteration

Fixes pypa/pipenv#2426
  • Loading branch information
hroncok committed Jun 26, 2018
1 parent 4a21c5c commit c44f212
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion prettytoml/elements/abstracttable.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ def _enumerate_items(self):
"""
non_metadata = self._enumerate_non_metadata_sub_elements()
while True:
yield next(non_metadata), next(non_metadata)
try:
yield next(non_metadata), next(non_metadata)
except StopIteration:
return

def items(self):
for (key_i, key), (value_i, value) in self._enumerate_items():
Expand Down

0 comments on commit c44f212

Please sign in to comment.