Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accurate return types for ZipFile.open() and zipfile.Path.open() #13069

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

AT0myks
Copy link

@AT0myks AT0myks commented Nov 22, 2024

An attempt to close #13051. Initially I used SizedBuffer for data in _ZipWriteFile.write() but this resulted in LSP violations.
For Python 3.8 _ReadWriteBinaryMode is replaced by _ReadWriteMode in zipfile.Path.open() because it did not yet accept modes rb and wb.
If I understand correctly, tests are failing because zipfile.Path.open(mode="rb") which now returns ZipExtFile does not comply anymore with importlib.abc.Traversable.open(mode="rb") which returns IO[bytes] and I'm not sure how this should be addressed.

This comment has been minimized.

Copy link
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

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.

ZipFile.open() return type
2 participants