Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork32k
gh-132983: Addcompression.zstd
and Python tests#133365
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Also as requested, pinging@Rogdham to review the Python code. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Review ofLib/compression/zstd/__init__.py
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
This review is focused on changes frompyzstd
.
My main issue isdecompress(compress(b"xxx") + b"yyy")
not raising an exception.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Rogdham left a comment• edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
These extra comments are due tooptions
being passed as positional arguments, but they are passed tolevel
parameter instead ofoptions
.
I hope I did not miss any 😅
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
I am working on addressing some of the issues which will include the test failures |
Uh oh!
There was an error while loading.Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Some nits, nothing major
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Comments on Lib/compression/zstd/_zstdfile.py
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Thanks for making the requested changes! @AA-Turner: please review the changes made to this pull request. |
emmatyping commentedMay 5, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
FWIW I believe I responded to all reviews, so I will add the buildbots to test this. |
bedevere-bot commentedMay 5, 2025
🤖 New build scheduled with the buildbot fleet by@emmatyping for commita12a031 🤖 Results will be shown at: https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F133365%2Fmerge If you want to schedule another build, you need to add the🔨 test-with-buildbots label again. |
Python, in general, works on protocols rather than nominal or specific types. I think this check is overly restrictive, with only minor benefit. Users wanting validation can use static type checkers.
I've pushed a series of commits. Most are explanatory and fairly minor (docstring wording, etc). The one of most note is removing the exact type checks on I've pushed this for speed, given time, but if you feel strongly I'm happy for you to revert. A |
@AA-Turner The commits look fine other than the last one. It is very important to check the type of a CompressionParameter vs DecompressionParameter because the C enum variants have overlapping values ( You can see in the tests this could lead to confusing errors:
I think I will revert the last commit but keep the others. |
This reverts commitbf4b07d.Checking the type of parameters is important to avoid confusing errormessages.
Yes, but I think the risk of this actually hitting users is low? For example, the examplar test failure you provided is very clear: I think it's fine to keep for now as we can discuss further and change this during the betas -- this particular item isn't impacted by feature freeze as it's entirely private. A |
I think we view the clarify of the error differently! To me I would expect users to not understand why they are getting an error about a decompression parameter when passing a compression parameter. I think perhaps a compromise would be to check the type if it is a (De)CompressionParameter, but otherwise just allow ints without checking. If you're passing an int, you're on your own! |
emmatyping commentedMay 6, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
After writing this:
I just checked and we only check if it is >>>from compression.zstdimport*>>> compress(b'testtesttest',options={100:5})b'(\xb5/\xfd \x0ca\x00\x00testtesttest' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
This is mergeable, we can tweak the few remaining items (eg. tarfile, parameter type checks, perhaps tests) after 3.14 beta 1.
Thanks everyone, and especially thank you@Rogdham for the valuable feedback & context frompyzstd
.
A
c273f59
intopython:mainUh oh!
There was an error while loading.Please reload this page.
emmatyping commentedMay 6, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Hear, hear! And thank you@AA-Turner for your suggestions and contributions! Thank you to all of the reviewers! |
# All *open() methods are registered here. | ||
OPEN_METH = { | ||
"tar": "taropen", # uncompressed tar | ||
"gz": "gzopen", # gzip compressed tar | ||
"bz2": "bz2open", # bzip2 compressed tar | ||
"xz": "xzopen" # lzma compressed tar | ||
"xz": "xzopen", # lzma compressed tar | ||
"zst": "zstopen" # zstd compressed tar |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Trailing comma would have been nice here 🙂
(noting this in case someone does another cleanup PR, but not to request one just for this)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
will add this to#133547, thanks!
Uh oh!
There was an error while loading.Please reload this page.
The next step to merging the PEP 784 implementation, this PR introduces
compression.zstd
and tests for the code (which I have been using to test the C code so far).Since test can be modified post-beta1, I'd like to focus on reviewing the API and Python implementation code. Obviously if there are important tests to add or change, that review would be valuable as well.