Skip to content

fix(fileutils): accept os.PathLike in AtomicSaver - #416

Merged
mahmoud merged 1 commit into
mahmoud:masterfrom
uttam12331:fix/atomicsaver-pathlike
Jul 17, 2026
Merged

fix(fileutils): accept os.PathLike in AtomicSaver#416
mahmoud merged 1 commit into
mahmoud:masterfrom
uttam12331:fix/atomicsaver-pathlike

Conversation

@uttam12331

Copy link
Copy Markdown
Contributor

AtomicSaver.__init__ assigned dest_path directly to self.dest_path and later concatenated it as a string (dest_path + '.part'), which raises TypeError when a pathlib.Path is passed.

iter_find_files called .split() on the directory argument, which also fails for pathlib.Path.

Changes:

  • AtomicSaver.__init__: convert dest_path via os.fspath() at the top of the method, and use self.dest_path (the already-converted str) when building the .part path
  • iter_find_files: convert directory via os.fspath() before calling .split()
  • Add test_atomicsaver_pathlike and test_iter_find_files_pathlike to the test suite

Closes #383

@mahmoud

mahmoud commented Jul 17, 2026

Copy link
Copy Markdown
Owner

Good call, pathlib support here was overdue. Thanks for the fix + tests!

@mahmoud
mahmoud merged commit 55dfe50 into mahmoud:master Jul 17, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Supporting more PathLike in path-related methods

2 participants