Mercurial > hgrepos > Python > apps > py-cutils
diff shasum.py @ 61:c9f9401abc0c
Use getattr when trying to get mmap.madvise()
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Wed, 09 Feb 2022 12:00:27 +0100 |
| parents | 21d2589c96b9 |
| children | c52e5f86b0ab |
line wrap: on
line diff
--- a/shasum.py Tue Feb 08 21:45:14 2022 +0100 +++ b/shasum.py Wed Feb 09 12:00:27 2022 +0100 @@ -481,10 +481,7 @@ # NOTE: On Windows mmapped files with length 0 are not supported. # So ensure to not call mmap.mmap() if the file size is 0. # - try: - madvise = mmap.mmap.madvise - except AttributeError: - madvise = None + madvise = getattr(mmap.mmap, "madvise", None) if filesize < MAP_CHUNK_SIZE: mapsize = filesize else:
