diff options
author | Benjamin Schubert <ben.c.schubert@gmail.com> | 2019-05-17 15:17:47 +0100 |
---|---|---|
committer | Benjamin Schubert <contact@benschubert.me> | 2019-05-29 19:47:57 +0100 |
commit | a521c0f0f65afdd3b4e76b403cd28fe627a94914 (patch) | |
tree | c8c0604bac019a398a2c13b14f13a8dc0b641fba /src | |
parent | d1fa3bb34147ba2d14abd10e9343de61425e5c75 (diff) | |
download | buildstream-a521c0f0f65afdd3b4e76b403cd28fe627a94914.tar.gz |
_variables: Cythonize Variables._flatten
Diffstat (limited to 'src')
-rw-r--r-- | src/buildstream/_variables.pyx | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/buildstream/_variables.pyx b/src/buildstream/_variables.pyx index 0e3bdb29c..d12938dd9 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] |