summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJürg Billeter <j@bitron.ch>2018-08-07 16:22:34 +0200
committerJürg Billeter <j@bitron.ch>2018-08-07 15:36:35 +0000
commitea27e389c629330ac58c746d22b1742a8f18e97d (patch)
treedf709b2e074090bf558915176c05fa65d589e13c
parenteee4b674f719cde301c9bcf108c0d7477337308a (diff)
downloadbuildstream-ea27e389c629330ac58c746d22b1742a8f18e97d.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 1b2dc198f..c4b3688d4 100644
--- a/buildstream/_artifactcache/cascache.py
+++ b/buildstream/_artifactcache/cascache.py
@@ -846,6 +846,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))