Small fix to correctly handle default arguments

Dictionaries are mutable, and should not be assigned as a default
parameter.

Change-Id: Id08c17f89c17b404560241849603e1e1a0ec6562
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
This commit is contained in:
Alexandru Croitor 2019-08-01 16:01:22 +02:00
parent 97b76704ea
commit cb370593df

View File

@ -374,10 +374,14 @@ class Scope(object):
parent_scope: typing.Optional[Scope],
file: typing.Optional[str] = None, condition: str = '',
base_dir: str = '',
operations: typing.Mapping[str, typing.List[Operation]] = {
'QT_SOURCE_TREE': [SetOperation(['${QT_SOURCE_TREE}'])],
'QT_BUILD_TREE': [SetOperation(['${PROJECT_BUILD_DIR}'])],
}) -> None:
operations: typing.Union[
typing.Mapping[str, typing.List[Operation]], None] = None) -> None:
if operations is None:
operations = {
'QT_SOURCE_TREE': [SetOperation(['${QT_SOURCE_TREE}'])],
'QT_BUILD_TREE': [SetOperation(['${PROJECT_BUILD_DIR}'])],
}
self._operations = copy.deepcopy(operations)
if parent_scope:
parent_scope._add_child(self)