You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Regression in zipfile, read1(-1) after seek() returns empty byte string #102956
When debugging a test failure in https://pypi.org/project/fs/ I found a regression in zipfile, read1(-1) after seek() returns empty byte string instead of substring. I've bisected it into this commit 330f1d5.
Reproducer:
import zipfile
# First, create the zip:
# echo 'Hello, World' > hello.txt
# zip hello.zip hello.txt
with zipfile.ZipFile('hello.zip') as myzip:
with myzip.open('hello.txt') as myfile:
print(myfile.read(5))
print(myfile.seek(2, 1))
print(myfile.read1(-1))
Expected output (3.11.2):
❯ python3.11 reproduce.py
b'Hello'
7
b'World\n'
Actual output (3.12.0a6):
❯ python3.12 reproduce.py
b'Hello'
7
b''
Your environment
CPython versions tested on: main
Operating system and architecture: Fedora 37, x86_64
Activity
arhadthedev commentedon Mar 23, 2023
@serhiy-storchaka, @Yhg1s, @gpshead (as zipfile experts)
pythongh-102956: Fix returning of empty byte strings after seek in zi…
pythongh-102956: Fix returning of empty byte strings after seek in zi…
mgorny commentedon Oct 24, 2023
Ping. This is still breaking
fs, and there's a patch waiting for review since April.dev-lang/python: Add a zipfile fix from upstream PR, as 3.12.0_p1
gh-102956: Fix returning of empty byte strings after seek in zipfile … (
pythongh-102956: Fix returning of empty byte strings after seek in zi…
[3.12] gh-102956: Fix returning of empty byte strings after seek in z…
gpshead commentedon Oct 25, 2023
Thanks! 3.12.1 should include the fix.
dev-lang/python: Add a zipfile fix from upstream PR, as 3.12.0_p1
pythongh-102956: Fix returning of empty byte strings after seek in zi…
pythongh-102956: Fix returning of empty byte strings after seek in zi…