X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?p=bup.git;a=blobdiff_plain;f=lib%2Fbup%2Fio.py;fp=lib%2Fbup%2Fio.py;h=e2fd410b3eb8b1eb444118acf06a8f8e88a8f62c;hp=79a6d83d5468c0e026a53415ce5dd91bf5d9bafc;hb=26f70b361610366de64a160bf49528dcf933ad5f;hpb=36fce270ed41330d1cf4ada5dda17c1b816f677d diff --git a/lib/bup/io.py b/lib/bup/io.py index 79a6d83..e2fd410 100644 --- a/lib/bup/io.py +++ b/lib/bup/io.py @@ -22,14 +22,17 @@ class mmap(py_mmap.mmap): that aren't explicitly closed. ''' + def __new__(cls, *args, **kwargs): + result = super().__new__(cls, *args, **kwargs) + result._bup_closed = True # supports __del__ + return result def __init__(self, *args, **kwargs): - self._bup_closed = True # Silence deprecation warnings. mmap's current parent is # object, which accepts no params and as of at least 2.7 # warns about them. if py_mmap.mmap.__init__ is not object.__init__: - super(mmap, self).__init__(self, *args, **kwargs) + super().__init__(self, *args, **kwargs) self._bup_closed = False def close(self):