You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildstream.apache.org by ju...@apache.org on 2022/07/26 07:38:13 UTC

[buildstream] 01/01: Do not use `zip(..., strict=True)` as it requires Python 3.10

This is an automated email from the ASF dual-hosted git repository.

juergbi pushed a commit to branch juerg/zip-strict
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit db899dae7127558f89278464c37962a5365b390f
Author: Jürg Billeter <j...@bitron.ch>
AuthorDate: Tue Jul 26 09:36:35 2022 +0200

    Do not use `zip(..., strict=True)` as it requires Python 3.10
---
 src/buildstream/_artifact.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/buildstream/_artifact.py b/src/buildstream/_artifact.py
index ea57b741b..019ca1ff4 100644
--- a/src/buildstream/_artifact.py
+++ b/src/buildstream/_artifact.py
@@ -279,7 +279,10 @@ class Artifact:
 
             # Capture queued files and store returned digests
             digests = self._cas.add_objects(paths=[entry[0] for entry in files_to_capture])
-            for entry, digest in zip(files_to_capture, digests, strict=True):
+            # add_objects() should guarantee this.
+            # `zip(..., strict=True)` could be used in Python 3.10+
+            assert len(files_to_capture) == len(digests)
+            for entry, digest in zip(files_to_capture, digests):
                 entry[1].CopyFrom(digest)
                 size += digest.size_bytes