Commit 522867c8 authored by Daniel Silverstone's avatar Daniel Silverstone
Browse files

_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: default avatarDaniel Silverstone <daniel.silverstone@codethink.co.uk>
parent 247b9fa8
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -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):
+2 −2
Original line number Diff line number Diff line
@@ -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():
    #