summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJürg Billeter <j@bitron.ch>2018-08-07 16:22:34 +0200
committerValentin David <valentin.david@gmail.com>2018-08-13 15:39:22 +0000
commit002749b598954e8426f4477789f4c9e5d020961d (patch)
treec20eb2005a19339458246e51f0af593637a0d07d
parent6a2f3b59b0ec99a89e46e6dd12f13ef4de0d8a88 (diff)
downloadbuildstream-002749b598954e8426f4477789f4c9e5d020961d.tar.gz
_artifactcache/cascache.py: Fix for PEP 479 / Python 3.7
Do not rely on `StopIteration` bubbling up. https://www.python.org/dev/peps/pep-0479/
-rw-r--r--buildstream/_artifactcache/cascache.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/buildstream/_artifactcache/cascache.py b/buildstream/_artifactcache/cascache.py
index 74422241c..4fea98626 100644
--- a/buildstream/_artifactcache/cascache.py
+++ b/buildstream/_artifactcache/cascache.py
@@ -845,6 +845,9 @@ class _CASRemote():
def _grouper(iterable, n):
- # pylint: disable=stop-iteration-return
while True:
- yield itertools.chain([next(iterable)], itertools.islice(iterable, n - 1))
+ try:
+ current = next(iterable)
+ except StopIteration:
+ return
+ yield itertools.chain([current], itertools.islice(iterable, n - 1))