summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Silverstone <daniel.silverstone@codethink.co.uk>2018-10-24 10:02:02 +0100
committerDaniel Silverstone <daniel.silverstone@codethink.co.uk>2018-10-25 15:43:52 +0100
commit522867c8a2c3bccc5230cdb27adfdf2dce6fff49 (patch)
tree10ed056d3d764c18d75c093df0b97fb6339e44be
parent247b9fa87de2ff8c5409a89add61e2a9c2b2b46d (diff)
downloadbuildstream-522867c8a2c3bccc5230cdb27adfdf2dce6fff49.tar.gz
_fuse/{hardlinks,mount}.py: Remove dangerous use of {} in defaults
Since default values in arguments to functions and methods are created once at the compilation of the code, it is dangerous to include list and dict literals in them. This changes the use of {} to None. Signed-off-by: Daniel Silverstone <daniel.silverstone@codethink.co.uk>
-rw-r--r--buildstream/_fuse/hardlinks.py4
-rw-r--r--buildstream/_fuse/mount.py4
2 files changed, 5 insertions, 3 deletions
diff --git a/buildstream/_fuse/hardlinks.py b/buildstream/_fuse/hardlinks.py
index 0797cb4bc..ff2e81eea 100644
--- a/buildstream/_fuse/hardlinks.py
+++ b/buildstream/_fuse/hardlinks.py
@@ -42,9 +42,11 @@ from .mount import Mount
#
class SafeHardlinks(Mount):
- def __init__(self, directory, tempdir, fuse_mount_options={}):
+ def __init__(self, directory, tempdir, fuse_mount_options=None):
self.directory = directory
self.tempdir = tempdir
+ if fuse_mount_options is None:
+ fuse_mount_options = {}
super().__init__(fuse_mount_options=fuse_mount_options)
def create_operations(self):
diff --git a/buildstream/_fuse/mount.py b/buildstream/_fuse/mount.py
index 83c98a97a..ca5ed023c 100644
--- a/buildstream/_fuse/mount.py
+++ b/buildstream/_fuse/mount.py
@@ -87,8 +87,8 @@ class Mount():
# User Facing API #
################################################
- def __init__(self, fuse_mount_options={}):
- self._fuse_mount_options = fuse_mount_options
+ def __init__(self, fuse_mount_options=None):
+ self._fuse_mount_options = {} if fuse_mount_options is None else fuse_mount_options
# mount():
#