# HG changeset patch # User Franz Glasner # Date 1645880904 -3600 # Node ID 19893b4f42a5c72e306fa555be8c09d6bb1a6941 # Parent c52e5f86b0ab0697331098dd5b6fac026ce166bc Flag to disable the use of mmap diff -r c52e5f86b0ab -r 19893b4f42a5 shasum.py --- a/shasum.py Sat Feb 26 13:56:13 2022 +0100 +++ b/shasum.py Sat Feb 26 14:08:24 2022 +0100 @@ -453,10 +453,11 @@ file=dest) -def compute_digest_file(hashobj, filename): +def compute_digest_file(hashobj, filename, use_mmap=True): """ :param hashobj: a :mod:`hashlib` compatible hash algorithm type or factory :param str filename: filename within the filesystem + :param bool use_mmap: use the :mod:`mmap` module if available :return: the digest in binary form :rtype: bytes @@ -468,7 +469,7 @@ try: st = os.fstat(fd) filesize = st[stat.ST_SIZE] - if mmap is None: + if mmap is None or not use_mmap: # No mmmap available -> use traditional low-level file IO while True: try: