Thanks to visit codestin.com
Credit goes to github.com

Skip to content

3.14: PEP-784 compression except zstd #13992

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

Merged
merged 5 commits into from
May 11, 2025
Merged

Conversation

Rogdham
Copy link
Contributor

@Rogdham Rogdham commented May 10, 2025

First PR about PEP-784 in sdlib:

  • Re-export bz2/gzip/lzma/zlib in compression.*
  • Copy _compression into compression._common._streams, and re-export the latter from the former
  • Modify the stubtest_allowlists for 3.14 accordingly (the additions are copied that already exists in the non-compression modules)

For the last point, I did not find a better way than copying the file, because only one of the two modules exist depending on Python version (so cannot import from the other) ▶️ feel free to suggest a better idea! (or tell if I should add a comment about that somewhere)

Adding compression.zstd will be done in a distinct PR.

This comment has been minimized.

@python python deleted a comment May 10, 2025
@Rogdham Rogdham force-pushed the pep-784_compression branch from 27b8b34 to 06181bc Compare May 10, 2025 20:01

This comment has been minimized.

@Rogdham Rogdham force-pushed the pep-784_compression branch from 06181bc to e728c53 Compare May 10, 2025 20:12

This comment has been minimized.

@Rogdham Rogdham force-pushed the pep-784_compression branch 2 times, most recently from 562bf17 to 24dafa3 Compare May 10, 2025 21:12

This comment has been minimized.

@Rogdham Rogdham marked this pull request as ready for review May 10, 2025 21:26
@srittau
Copy link
Collaborator

srittau commented May 10, 2025

There's a (small) merge conflict now due to allowlist changes.

One request: Please don't force push here as that makes reviewing harder. We squash on merge anyway.

@Rogdham
Copy link
Contributor Author

Rogdham commented May 10, 2025

Conflict should be resolved now.

Sorry for the force-pushes earlier, I thought it was ok while the PR had the draft status.

This comment has been minimized.

Copy link
Collaborator

@srittau srittau left a comment

Choose a reason for hiding this comment

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

Thanks, a few remarks below.

@@ -0,0 +1,25 @@
from _typeshed import WriteableBuffer
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
from _typeshed import WriteableBuffer
from _typeshed import Incomplete, WriteableBuffer

See below.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I just copied that file from _compression.pyi without any changes, should I make the requested changes on _compression.pyi as well?

Copy link
Collaborator

Choose a reason for hiding this comment

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

That would be great, thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That should be done now!

Do you have any thoughts on the code duplication between the two? Like a way to remove the duplication, or if I should add a comment on both files telling that the other should probably be updated at the same time.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe it would make sense to add a comment to the top of _compression.pyi to copy all changes to compression.*. I don't think the reverse direction is as important (and often the changes won't apply to older Python versions anyway.) Maybe add a comment to DecompressReader.decomp_factory in case someone actually adds a proper return type at some point.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have added the two comments, hopefully the wording is ok

This comment has been minimized.

Copy link
Contributor

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

@srittau srittau merged commit 78fc518 into python:main May 11, 2025
69 checks passed
@Rogdham Rogdham deleted the pep-784_compression branch May 11, 2025 13:43
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