summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Schubert <ben.c.schubert@gmail.com>2019-05-17 15:17:47 +0100
committerBenjamin Schubert <ben.c.schubert@gmail.com>2019-05-29 11:59:56 +0100
commitbae098e143df305f8e911363fd5a2152616200d9 (patch)
treecc88cc5a3cb3782adcd8f620774b028200c02c0d
parent9f5f97fec72845930b2e723bc6bd7913108a885f (diff)
downloadbuildstream-bae098e143df305f8e911363fd5a2152616200d9.tar.gz
_variables: Cythonize Variables._flatten
-rw-r--r--src/buildstream/_variables.pyx8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/buildstream/_variables.pyx b/src/buildstream/_variables.pyx
index f6819767d..598efe39c 100644
--- a/src/buildstream/_variables.pyx
+++ b/src/buildstream/_variables.pyx
@@ -172,11 +172,15 @@ cdef class Variables:
# LoadError, if the string contains unresolved variable references or
# if cycles are detected in the variable references
#
- def _flatten(self):
- flat = {}
+ cdef dict _flatten(self):
+ cdef dict flat = {}
+ cdef str key
+ cdef list expstr
+
try:
for key, expstr in self._expstr_map.items():
if len(expstr) > 1:
+ # FIXME: do we really gain anything by interning?
expstr = [sys.intern(_expand_expstr(self._expstr_map, expstr))]
self._expstr_map[key] = expstr
flat[key] = expstr[0]