This is an automated email from the ASF dual-hosted git repository. tvb pushed a commit to branch tristan/change-remote-config in repository https://gitbox.apache.org/repos/asf/buildstream.git
commit 3f7b5be3d9825ca545dabcdea27fdd9e02a0147a Author: Tristan van Berkom <tris...@codethink.co.uk> AuthorDate: Sun Jan 24 12:43:41 2021 +0900 node.pyx: Fixed error reporting in SequenceNode.as_str_list() This function was not validating that it was in fact a list of scalar nodes, so calling this, or MappingNode.get_str_list(), on a list of lists or a list of dictionaries, would result in an unhandled runtime exception rather than a properly reported LoadError. --- src/buildstream/node.pyx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/buildstream/node.pyx b/src/buildstream/node.pyx index 9a0bd2e..b16e8b3 100644 --- a/src/buildstream/node.pyx +++ b/src/buildstream/node.pyx @@ -1255,7 +1255,16 @@ cdef class SequenceNode(Node): Returns: :class:`list`: the content of the sequence as a list of strings """ - return [node.as_str() for node in self.value] + cdef list str_list = [] + cdef Node node + for node in self.value: + if type(node) is not ScalarNode: + provenance = node.get_provenance() + raise LoadError("{}: List item is not of the expected type 'scalar'" + .format(provenance), LoadErrorReason.INVALID_DATA) + str_list.append(node.as_str()) + + return str_list cpdef MappingNode mapping_at(self, int index): """mapping_at(index)