diff options
author | Benjamin Schubert <ben.c.schubert@gmail.com> | 2019-06-03 14:34:51 +0100 |
---|---|---|
committer | Benjamin Schubert <ben.c.schubert@gmail.com> | 2019-06-03 15:12:36 +0100 |
commit | 49262bda8e5bc3a1886256a848618ae22229135e (patch) | |
tree | 293e9190acf877b600f4afc17aa85fcf5af0969c /doc | |
parent | 6b1f04769601328dfdd724103a4e08fc8623599c (diff) | |
download | buildstream-49262bda8e5bc3a1886256a848618ae22229135e.tar.gz |
_yaml.pyx: Forbid expected_type=Mapping, and remove isinstance check
Calls to `isinstance` can be particularily costly. Using type() is
much faster. The only known case where the `isinstance` was useful
is for dictionnaries where we would ask for a 'Mapping' instead.
Disallowing 'Mapping' for expected_type considerably speeds up the
calls to this functions.
Also add into NEWS
Diffstat (limited to 'doc')
-rwxr-xr-x | doc/bst2html.py | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/doc/bst2html.py b/doc/bst2html.py index 2f4012695..448ab1389 100755 --- a/doc/bst2html.py +++ b/doc/bst2html.py @@ -29,7 +29,6 @@ import sys import re import shlex import subprocess -from collections.abc import Mapping from contextlib import contextmanager from tempfile import TemporaryDirectory @@ -348,7 +347,7 @@ def run_session(description, tempdir, source_cache, palette, config_file, force) # tarball. This workaround lets us build docs from # a source distribution tarball. # - symlinks = _yaml.node_get(desc, Mapping, 'workaround-symlinks', default_value={}) + symlinks = _yaml.node_get(desc, dict, 'workaround-symlinks', default_value={}) for symlink, target in _yaml.node_items(symlinks): # Resolve real path to where symlink should be @@ -382,7 +381,7 @@ def run_session(description, tempdir, source_cache, palette, config_file, force) # commands = _yaml.node_get(desc, list, 'commands') for c in commands: - command = _yaml.node_get(desc, Mapping, 'commands', indices=[commands.index(c)]) + command = _yaml.node_get(desc, dict, 'commands', indices=[commands.index(c)]) # Get the directory where this command should be run directory = _yaml.node_get(command, str, 'directory') |