X-Git-Url: https://arthur.barton.de/gitweb/?a=blobdiff_plain;f=lib%2Fbup%2Fcompat.py;h=00575036e27cc46f7fb6b3408e273831526b9daa;hb=4448f184253125e1b8bd0c55d0098a335d15b90b;hp=9def12a9d729a7044a6102381d94d772ef31564b;hpb=9f9466ee3e07e159c276af57ddf92a8d1e5ac126;p=bup.git diff --git a/lib/bup/compat.py b/lib/bup/compat.py index 9def12a..0057503 100644 --- a/lib/bup/compat.py +++ b/lib/bup/compat.py @@ -14,7 +14,6 @@ if py3: # pylint: disable=unused-import from contextlib import ExitStack, nullcontext - from mmap import mmap from os import environb as environ from os import fsdecode, fsencode from shlex import quote @@ -89,7 +88,6 @@ if py3: else: # Python 2 from contextlib import contextmanager - import mmap as py_mmap ModuleNotFoundError = ImportError @@ -225,30 +223,6 @@ else: # Python 2 buffer = buffer - assert not hasattr(py_mmap.mmap, '__del__') - assert not hasattr(py_mmap.mmap, '__enter__') - assert not hasattr(py_mmap.mmap, '__exit__') - - class mmap(py_mmap.mmap): - 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) - self._bup_closed = False - def close(self): - self._bup_closed = True - super(mmap, self).close() - def __enter__(self): - return self - def __exit__(self, type, value, traceback): - with pending_raise(value, rethrow=False): - self.close() - def __del__(self): - assert self._bup_closed - try: import bup_main except ModuleNotFoundError: