diff options
author | Jürg Billeter <j@bitron.ch> | 2018-08-07 16:22:34 +0200 |
---|---|---|
committer | Jürg Billeter <j@bitron.ch> | 2018-08-07 15:36:35 +0000 |
commit | ea27e389c629330ac58c746d22b1742a8f18e97d (patch) | |
tree | df709b2e074090bf558915176c05fa65d589e13c /buildstream | |
parent | eee4b674f719cde301c9bcf108c0d7477337308a (diff) | |
download | buildstream-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/
Diffstat (limited to 'buildstream')
-rw-r--r-- | buildstream/_artifactcache/cascache.py | 7 |
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)) |