Skip to content

Accept PathLike local destinations in synchronous get - #2278

Open
adenzhou1350 wants to merge 1 commit into
fsspec:masterfrom
adenzhou1350:codex/fix-pathlike-get-destination
Open

adenzhou1350 wants to merge 1 commit into
fsspec:masterfrom
adenzhou1350:codex/fix-pathlike-get-destination

Conversation

@adenzhou1350

Copy link
Copy Markdown

Fixes #896.

get(remote_path, pathlib.Path(local_path)) raises TypeError: object of type 'Path' has no len() because a scalar PathLike destination reaches other_paths as though it were a destination list.

Pass os.PathLike destinations through the existing make_path_posix normalization, just as string destinations already are. Lists retain their existing behavior. The real async _get already normalizes PathLike destinations and needs no change.

Regression coverage uses the public memory filesystem get with strings, pathlib and a custom __fspath__ object: renamed files, existing directories, globs, source lists, explicit destination lists and recursive copies with/without trailing slashes.

Validation against master 94afb3f6:

  • Matched Windows Python 3.14 and Linux Python 3.12 regression runs: before 10 failed / 8 passed; after 18 passed on each OS.
  • Related memory/local/spec/utility/callback and bulk-copy suites: Windows 945 passed, 128 skipped, 10 xfailed, 2 failures, 4 setup errors; Linux 1044 passed, 28 skipped, 1 xfailed, 4 setup errors. The remaining failures/errors occur unchanged on the baseline: Windows cannot create the test's | filenames, and both environments lack the mocker fixture. No newly failing test names.
  • Separate native relative/absolute destination checks confirm the async base implementation already passes and the sync implementation passes after this change.
  • Diff check passes. Lint, the complete upstream dependency/OS matrix and cloud integrations were not run locally.

AI-assisted; independently reproduced through the actual filesystem implementation, not an extracted helper or mocked import.

Signed-off-by: Xucheng Zhou <aden1350@outlook.com>
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.

lpath of filesystem.get doesn't handle pathlib.Path gracefully

1 participant