# HG changeset patch # User Franz Glasner # Date 1644348685 -3600 # Node ID ae5b31c10b41fd2b1d263d9d9f15e4611e133c92 # Parent 0fa2067bedb83b28153aab45db21c541dad6eced Enhance comments diff -r 0fa2067bedb8 -r ae5b31c10b41 shasum.py --- a/shasum.py Tue Feb 08 17:13:15 2022 +0100 +++ b/shasum.py Tue Feb 08 20:31:25 2022 +0100 @@ -470,18 +470,20 @@ try: st = os.fstat(fd) filesize = st[stat.ST_SIZE] - # - # On Windows mmapped file with length 0 are not supported - # -> use low-level IO - # if mmap is None: + # No mmmap available -> use traditional low-level file IO while True: buf = os.read(fd, CHUNK_SIZE) if len(buf) == 0: break h.update(buf) else: - # mmap + # + # Use mmap + # + # NOTE: On Windows mmapped files with length 0 are not supported. + # So ensure to not call mmap.mmap() if the file size is 0. + # if filesize < MAP_CHUNK_SIZE: mapsize = filesize else: