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.
Projectmahmoud/boltons
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
| 386 | 386 | ||
| 387 | 387 | # TODO: option to abort if target file modify date has changed since start? | |
| 388 | 388 | def __init__(self, dest_path, **kwargs): | |
| 389 | - | self.dest_path = dest_path | |
| 389 | + | self.dest_path = os.fspath(dest_path) | |
| 390 | 390 | self.overwrite = kwargs.pop('overwrite', True) | |
| 391 | 391 | self.file_perms = kwargs.pop('file_perms', None) | |
| 392 | 392 | self.overwrite_part = kwargs.pop('overwrite_part', False) | |
| ⋯ | |||
| 400 | 400 | self.dest_path = os.path.abspath(self.dest_path) | |
| 401 | 401 | self.dest_dir = os.path.dirname(self.dest_path) | |
| 402 | 402 | if not self.part_filename: | |
| 403 | - | self.part_path = dest_path + '.part' | |
| 403 | + | self.part_path = self.dest_path + '.part' | |
| 404 | 404 | else: | |
| 405 | 405 | self.part_path = os.path.join(self.dest_dir, self.part_filename) | |
| 406 | 406 | self.mode = 'w+' if self.text_mode else 'w+b' | |
| ⋯ | |||
| 530 | 530 | elif isinstance(ignored, str): | |
| 531 | 531 | ignored = [ignored] | |
| 532 | 532 | ign_re = re.compile('|'.join([fnmatch.translate(p) for p in ignored])) | |
| 533 | + | directory = os.fspath(directory) | |
| 533 | 534 | start_depth = len(directory.split(os.path.sep)) | |
| 534 | 535 | for root, dirs, files in os.walk(directory): | |
| 535 | 536 | if max_depth is not None and (len(root.split(os.path.sep)) - start_depth) > max_depth: | |
The check that tells the two apart
fail→pass·tests/test_fileutils.py::test_atomicsaver_pathlike
fail→pass·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
- 2026-08-06Bits
- 2026-08-06JSONLIterator
- 2026-08-06tableutils: fix Table.to_text crashes on degenerate tables and headers
- 2026-07-18backoff_iter
- 2026-07-17singularize
- 2026-07-17Fix copy.copy/copy.deepcopy collapsing OrderedMultiDict values