From 81c34340cb335608f7e161a341db374ca2b86499 Mon Sep 17 00:00:00 2001 From: Benjamin Schubert Date: Wed, 5 Jun 2019 22:18:09 +0100 Subject: _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. --- src/buildstream/_loader/types.pyx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/buildstream/_loader') 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 -- cgit v1.2.1