summaryrefslogtreecommitdiff
path: root/src/buildstream/_gitsourcebase.py
diff options
context:
space:
mode:
authorBenjamin Schubert <ben.c.schubert@gmail.com>2019-06-03 14:34:51 +0100
committerBenjamin Schubert <ben.c.schubert@gmail.com>2019-06-03 15:12:36 +0100
commit49262bda8e5bc3a1886256a848618ae22229135e (patch)
tree293e9190acf877b600f4afc17aa85fcf5af0969c /src/buildstream/_gitsourcebase.py
parent6b1f04769601328dfdd724103a4e08fc8623599c (diff)
downloadbuildstream-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 'src/buildstream/_gitsourcebase.py')
-rw-r--r--src/buildstream/_gitsourcebase.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/buildstream/_gitsourcebase.py b/src/buildstream/_gitsourcebase.py
index 7d07c56cb..7f02af40d 100644
--- a/src/buildstream/_gitsourcebase.py
+++ b/src/buildstream/_gitsourcebase.py
@@ -24,7 +24,6 @@
import os
import re
import shutil
-from collections.abc import Mapping
from io import StringIO
from tempfile import TemporaryFile
@@ -413,9 +412,9 @@ class _GitSourceBase(Source):
# and submodule_checkout_overrides dictionaries.
self.submodule_overrides = {}
self.submodule_checkout_overrides = {}
- modules = self.node_get_member(node, Mapping, 'submodules', {})
+ modules = self.node_get_member(node, dict, 'submodules', {})
for path, _ in self.node_items(modules):
- submodule = self.node_get_member(modules, Mapping, path)
+ submodule = self.node_get_member(modules, dict, path)
url = self.node_get_member(submodule, str, 'url', None)
# Make sure to mark all URLs that are specified in the configuration