summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Schubert <ben.c.schubert@gmail.com>2019-07-03 18:30:50 +0100
committerBenjamin Schubert <ben.c.schubert@gmail.com>2019-07-09 16:55:55 +0100
commitbc63994aeacb650af5cb5dab20da532269cf266c (patch)
tree6a766fbb49e042bc40dc342eb6417148b78c2a16
parent2139089b237491b09557bbd0b6c8c59b8688756c (diff)
downloadbuildstream-bc63994aeacb650af5cb5dab20da532269cf266c.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.pxd8
-rw-r--r--src/buildstream/_yaml.pyx2
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: