Skip to content

Honor pipe_file mode='create' in the reference filesystem - #2486

Open
09Catho wants to merge 1 commit into
fsspec:masterfrom
09Catho:fix/reference-pipe-file-mode-2470
Open

09Catho wants to merge 1 commit into
fsspec:masterfrom
09Catho:fix/reference-pipe-file-mode-2470

Conversation

@09Catho

@09Catho 09Catho commented Nov 20, 2026

Copy link
Copy Markdown

ReferenceFileSystem overrides the sync pipe_file and takes **_, so mode is dropped and pipe_file(path, data, mode="create") overwrites an existing key instead of raising FileExistsError. The async _pipe_file already has this check, but because the sync override exists, _pipe_file is never mirrored to pipe_file.

fs = fsspec.filesystem("reference", fo={"a": b"old"})
fs.pipe_file("a", b"new", mode="create")  # no error, "a" is now b"new"

This adds the same check to the sync method. It is the reference half of item 2 in #2470; #2482 covers simplecache.

I kept the method instead of deleting it in favour of _pipe_file, because #2377 updates the directory listing from this method and removing it would conflict with that PR.

Added test_pipe_file_mode_create in test_reference.py. It fails on main with DID NOT RAISE FileExistsError and passes with the change.

Ran locally on Windows, Python 3.11:

  • pytest fsspec/implementations/tests/test_reference.py fsspec/tests/test_mapping.py fsspec/tests/test_async.py: 168 passed, 14 skipped
  • pre-commit run on the changed files: all hooks pass

The sync pipe_file override dropped mode, so mode="create" overwrote an existing key instead of raising FileExistsError. Part of fsspec#2470.
Copilot AI balanced review requested due to automatic review settings November 20, 2026 03:46

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

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.

2 participants