diff options
author | Benjamin Schubert <ben.c.schubert@gmail.com> | 2019-07-03 18:30:50 +0100 |
---|---|---|
committer | bst-marge-bot <marge-bot@buildstream.build> | 2019-07-15 14:14:03 +0000 |
commit | c2f3fade438a59dc834a4859b03524e1f259405e (patch) | |
tree | daefa03c8f96d12adceaf4a2cc6e5f25e260073a | |
parent | 8f74f13a9aa5c14bdf2ab751cce2dde856ba10d6 (diff) | |
download | buildstream-c2f3fade438a59dc834a4859b03524e1f259405e.tar.gz |
_yaml: Mark attributes on 'Node' as private (only c-accessible)
This ensures that we are not breaking our encapsulation and that the
modules accessing 'Node' from C are correctly typed.
-rw-r--r-- | src/buildstream/_yaml.pxd | 8 | ||||
-rw-r--r-- | src/buildstream/_yaml.pyx | 2 |
2 files changed, 6 insertions, 4 deletions
diff --git a/src/buildstream/_yaml.pxd b/src/buildstream/_yaml.pxd index 3ea788866..f0f3a4267 100644 --- a/src/buildstream/_yaml.pxd +++ b/src/buildstream/_yaml.pxd @@ -22,10 +22,10 @@ cdef class Node: - cdef public object value - cdef public int file_index - cdef public int line - cdef public int column + cdef object value + cdef int file_index + cdef int line + cdef int column cpdef Node copy(self) cpdef object strip_node_info(self) diff --git a/src/buildstream/_yaml.pyx b/src/buildstream/_yaml.pyx index 176f2be59..ba58b39f0 100644 --- a/src/buildstream/_yaml.pyx +++ b/src/buildstream/_yaml.pyx @@ -514,6 +514,8 @@ cdef class MappingNode(Node): del self.value[key] def __setitem__(self, str key, object value): + cdef Node old_value + if type(value) in [MappingNode, ScalarNode, SequenceNode]: self.value[key] = value else: |