From e371ba3dc89fed989ff09399188ad3b849eb03bd Mon Sep 17 00:00:00 2001 From: Mara Kyte Date: Sat, 20 Dec 2025 07:18:39 -0800 Subject: [PATCH 1/2] Only open files with os.O_BINARY on Windows, as it's only available there --- fmd5sum/fmd5sum.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/fmd5sum/fmd5sum.py b/fmd5sum/fmd5sum.py index 5d9340e..625b5b0 100644 --- a/fmd5sum/fmd5sum.py +++ b/fmd5sum/fmd5sum.py @@ -6,9 +6,13 @@ def md5sum(filename, blocksize=65536): """Optimized MD5 checksum calculator with low-level file I/O.""" + OPEN_FLAGS = os.O_RDONLY + if sys.platform.startswith("win32"): + OPEN_FLAGS |= os.O_BINARY + hash_md5 = hashlib.md5() try: - fd = os.open(filename, os.O_RDONLY | os.O_BINARY) + fd = os.open(filename, OPEN_FLAGS) with open(fd, "rb", closefd=True) as f: while True: block = f.read(blocksize) From 1d8923471faf60deef54ed65fa0c22e80b26b234 Mon Sep 17 00:00:00 2001 From: Mara Kyte Date: Sat, 20 Dec 2025 07:24:18 -0800 Subject: [PATCH 2/2] Fix process_files import in last failing pytest --- fmd5sum/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fmd5sum/__init__.py b/fmd5sum/__init__.py index a0b0ce8..0e6e30a 100644 --- a/fmd5sum/__init__.py +++ b/fmd5sum/__init__.py @@ -1,6 +1,6 @@ -from .fmd5sum import md5sum, main +from .fmd5sum import md5sum, main, process_files -__all__ = ["md5sum", "main"] +__all__ = ["md5sum", "main", "process_files"] __version__ = "0.2.0" __author__ = "Jiale Chen"