Whole file

mahmoud/boltons

The author described this change as fix(fileutils): accept os.PathLike in AtomicSaver. It counts as a record because the checks below fail on the code as it stood at ebc7a8f77 and pass on 55dfe5077, with nothing else changed between the two runs.

Fix saved2026-07-17
Sharing licenceBSD-2-Clause · LICENSE
Change size+3 2

What the code was meant to do, written into the code itself as a save note

fix(fileutils): accept os.PathLike in AtomicSaver

The change

386386
387387 # TODO: option to abort if target file modify date has changed since start?
388388 def __init__(self, dest_path, **kwargs):
389- self.dest_path = dest_path
389+ self.dest_path = os.fspath(dest_path)
390390 self.overwrite = kwargs.pop('overwrite', True)
391391 self.file_perms = kwargs.pop('file_perms', None)
392392 self.overwrite_part = kwargs.pop('overwrite_part', False)
400400 self.dest_path = os.path.abspath(self.dest_path)
401401 self.dest_dir = os.path.dirname(self.dest_path)
402402 if not self.part_filename:
403- self.part_path = dest_path + '.part'
403+ self.part_path = self.dest_path + '.part'
404404 else:
405405 self.part_path = os.path.join(self.dest_dir, self.part_filename)
406406 self.mode = 'w+' if self.text_mode else 'w+b'
530530 elif isinstance(ignored, str):
531531 ignored = [ignored]
532532 ign_re = re.compile('|'.join([fnmatch.translate(p) for p in ignored]))
533+ directory = os.fspath(directory)
533534 start_depth = len(directory.split(os.path.sep))
534535 for root, dirs, files in os.walk(directory):
535536 if max_depth is not None and (len(root.split(os.path.sep)) - start_depth) > max_depth:

The check that tells the two apart

failpass·tests/test_fileutils.py::test_atomicsaver_pathlike
failpass·tests/test_fileutils.py::test_iter_find_files_pathlike

Check file tests/test_fileutils.py, taken without changes from the fix and copied onto the older code, so the exact same check runs against both versions.

Origin and history

The code before itebc7a8f776debfa33f0b380b57a444bca75a251b
Broken version dated2026-07-17
Moduleboltons.fileutils
Units changedAtomicSaver, iter_find_files
Fingerprintc8c53f66d2c48da2
Checked2026-08-18 by goldset/0.1

Every field above is generated by our program. None of it is written by hand.

Other bugs found in mahmoud/boltons