summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Schubert <contact@benschubert.me>2019-06-05 22:18:09 +0100
committerBenjamin Schubert <contact@benschubert.me>2019-06-07 17:28:11 +0000
commit81c34340cb335608f7e161a341db374ca2b86499 (patch)
tree39d245c491d2f5385127b43842cbc3063d5ddbd2
parente58e74ff100ad649b1025db65e11cd20ebeb4e2a (diff)
downloadbuildstream-81c34340cb335608f7e161a341db374ca2b86499.tar.gz
_loader/types: Use range() instead of enumerate in extract_depends_from_node
range() and access to the list can be optimized better by cython than the enumerate() call.
-rw-r--r--src/buildstream/_loader/types.pyx4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/buildstream/_loader/types.pyx b/src/buildstream/_loader/types.pyx
index 59352d68d..da33d6c54 100644
--- a/src/buildstream/_loader/types.pyx
+++ b/src/buildstream/_loader/types.pyx
@@ -142,11 +142,11 @@ cdef void _extract_depends_from_node(_yaml.Node node, str key, str default_dep_t
cdef int index
cdef _yaml.ProvenanceInformation dep_provenance
- for index, dep in enumerate(depends):
+ for index in range(len(depends)):
# FIXME: the provenance information would be obtainable from the Node directly if we stop
# stripping provenance and have proper nodes for str elements
dep_provenance = <_yaml.ProvenanceInformation> _yaml.node_get_provenance(node, key=key, indices=[index])
- dependency = Dependency(dep, dep_provenance, default_dep_type=default_dep_type)
+ dependency = Dependency(depends[index], dep_provenance, default_dep_type=default_dep_type)
acc.append(dependency)
# Now delete the field, we dont want it anymore