Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

prettytoml: Catch StopIteration in AbstractTable._enumerate_items #2427

Merged
merged 2 commits into from
Jun 26, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions news/2426.vendor
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add patch to ``prettytoml`` to support Python 3.7.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ index c9804ab5..89c95c45 100644
pass

# Check glibc version. CentOS 5 uses glibc 2.5.
- return pipenv.patched.notpip._internal.utils.glibc.have_compatible_glibc(2, 5)
- return pip._internal.utils.glibc.have_compatible_glibc(2, 5)
+ return pipenv.patched.notpip._internal.utils.glibc.have_compatible_glibc(2, 5)


Expand Down
32 changes: 32 additions & 0 deletions tasks/vendoring/patches/patched/prettytoml-python37.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
From c44f2126fb5c75a5f5afd9d320c9f6cfc4ce3384 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= <miro@hroncok.cz>
Date: Tue, 26 Jun 2018 21:02:45 +0200
Subject: [PATCH] Catch StopIteration in AbstractTable._enumerate_items

This makes PEP 479 enabled Pythons (such as 3.7) work again.

Otherwise you get:

RuntimeError: generator raised StopIteration

Fixes https://github.com/pypa/pipenv/issues/2426
---
pipenv/patched/prettytoml/elements/abstracttable.py | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/pipenv/patched/prettytoml/elements/abstracttable.py b/pipenv/patched/prettytoml/elements/abstracttable.py
index 59fd574..627da0e 100644
--- a/pipenv/patched/prettytoml/elements/abstracttable.py
+++ b/pipenv/patched/prettytoml/elements/abstracttable.py
@@ -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():