Skip to content

Update _compression, gzip, and test_gzip for CPython v3.11.2 #4688

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 2 commits into from
Mar 15, 2023

Conversation

tdub0
Copy link
Contributor

@tdub0 tdub0 commented Mar 13, 2023

Updated _compression.py to match CPython v3.11.2. I didn't see any immediate unit test for this, so it seemed fit to test using a library that relies on _compression.py. I updated gzip.py / test_gzip.py and accounted for the unexpected failures on test_gzip.py.

The failures were primarily wbit errors tracing to stdlib/src/zlib.rs, but I am not familiar enough with this module in rust to correct the issues.

@tdub0
Copy link
Contributor Author

tdub0 commented Mar 13, 2023

See #4564.

Copy link
Member

@youknowone youknowone left a comment

Choose a reason for hiding this comment

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

That's really good decision 😄
thank you!

@@ -1,7 +1,7 @@
"""Internal classes used by the gzip, lzma and bz2 modules"""
Copy link
Member

Choose a reason for hiding this comment

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

by looking the header, bz2 also seems to depending on here. could you also update it?

Copy link
Contributor

Choose a reason for hiding this comment

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

We have no bz2 rust library, unfortunately.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I hit the SkipTest: No module named ' bz2' when I copied over and ran the test_bz2.py as there were no changes in the Lib/bz2.py. Would this be connected to the bz2.rs in stdlib/src/

# sys.maxsize means the max length of output buffer is unlimited,
# so that the whole input buffer can be decompressed within one
# .decompress() call.
while data := self.read(sys.maxsize):
Copy link
Member

Choose a reason for hiding this comment

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

maybe we don't support this operator yet

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 did see a reference on L84 of compiler/ast/src/unparse.rs but it might not be handling it as the assignment operator described in PEP 572.

Copy link
Member

@youknowone youknowone left a comment

Choose a reason for hiding this comment

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

looks good, thank you!

@youknowone youknowone force-pushed the compression branch 3 times, most recently from 13687c3 to 407f3f5 Compare March 15, 2023 14:15
@youknowone youknowone merged commit 134d9f1 into RustPython:main Mar 15, 2023
@tdub0 tdub0 deleted the compression branch March 15, 2023 16:24
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.

3 participants