fix: raise UnsupportedOperation exception in fsspec.BufferedFile impl - #769
Open
RacleRay wants to merge 1 commit into
Open
fix: raise UnsupportedOperation exception in fsspec.BufferedFile impl#769RacleRay wants to merge 1 commit into
RacleRay wants to merge 1 commit into
Conversation
Member
|
Can you provide some rationale for this change? Is this something that fsspec expects? |
Author
|
Yes, the rationale: Problem: A file opened via obstore-fsspec crashes from obstore.fsspec import register
register("s3")
fs = fsspec.filesystem("s3", config=config)
with fs.open(url) as filelike, zipfile.ZipFile(filelike, "w") as zf: # ValueError raised here
...Root cause: our tell() raises a bare ValueError on non-seekable files, but ZipFile.init only catches (AttributeError, OSError) when probing fp.tell(), so the _Tellable fallback never kicks in (CPython 3.12, zipfile init.py:1352–1391): try:
self.start_dir = self.fp.tell()
except (AttributeError, OSError): # ValueError is NOT caught here
self.fp = _Tellable(self.fp)
self.start_dir = 0
self._seekable = FalseFix: io.UnsupportedOperation inherits from both OSError and ValueError Thanks for your reply. |
Member
|
Ok, could you add a test case to this PR that previously errored and now works? |
RacleRay
force-pushed
the
fix_fsspec_zip_failback
branch
from
August 23, 2026 16:56
cc7ed3c to
b6e7f6c
Compare
- zipfile.ZipFile.__init__ only catch `OSError` - io.UnsupportedOperation inherits `OSError` and `ValueError`, may be helpful - add a test simple test at tests/test_fsspec.py
RacleRay
force-pushed
the
fix_fsspec_zip_failback
branch
from
August 23, 2026 17:02
b6e7f6c to
505c8bc
Compare
Author
|
Done, added |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
OSErrorOSErrorandValueError, may be helpful