Skip to content

Keep the leading delimiter in read_block with split_before and no length - #2256

Open
LuisFigueroaG wants to merge 1 commit into
fsspec:masterfrom
LuisFigueroaG:fix/read-block-split-before
Open

LuisFigueroaG wants to merge 1 commit into
fsspec:masterfrom
LuisFigueroaG:fix/read-block-split-before

Conversation

@LuisFigueroaG

Copy link
Copy Markdown
Contributor

With length=None, read_block returns before applying split_before, so the block loses its leading delimiter, unlike a read with an explicit length that reaches the end of the file:

>>> f = io.BytesIO(b"123\n456\n789")
>>> read_block(f, 1, None, b"\n", split_before=True)
b'456\n789'
>>> read_block(f, 1, 100, b"\n", split_before=True)
b'\n456\n789'

Now both return b'\n456\n789'. The new test fails on master.

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.

1 participant