Skip to content

lzma implementation #5717

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 6 commits into from
May 7, 2025
Merged

lzma implementation #5717

merged 6 commits into from
May 7, 2025

Conversation

arihant2math
Copy link
Collaborator

Based on #5709 because of the zlib abstraction.

@arihant2math arihant2math marked this pull request as ready for review April 20, 2025 05:48
@arihant2math
Copy link
Collaborator Author

This turned out surprisingly effective, about 2/3s of the tests pass, which is enough for me at the moment. The main missing parts involve a bunch of unsafe things that xz2 doesn't really support (to my knowledge atleast).

As a side note I also abstracted out Compressor like Decompressor was abstracted

@arihant2math arihant2math force-pushed the lzma branch 2 times, most recently from c09442c to 2bad5d2 Compare April 21, 2025 00:01
@arihant2math arihant2math marked this pull request as draft April 21, 2025 02:24
@arihant2math arihant2math marked this pull request as ready for review April 21, 2025 02:24
@arihant2math
Copy link
Collaborator Author

Lots of tests are failing because they were previously blocked due to no implementation at all.

@arihant2math arihant2math changed the title Lzma implementation lzma implementation Apr 21, 2025
@coolreader18
Copy link
Member

coolreader18 commented Apr 21, 2025

Would you be able to squash these commits down? Ideally into one for copying the files from cpython, and one for all the rest?

@arihant2math
Copy link
Collaborator Author

Sure

@arihant2math arihant2math force-pushed the lzma branch 3 times, most recently from 19a43f5 to ca2dc44 Compare April 21, 2025 19:40
@arihant2math
Copy link
Collaborator Author

It's at 3 now, I committed things in a weird fashion so I can't get it below that.

Lib/tarfile.py Outdated
@@ -392,7 +392,8 @@ def __init__(self, name, mode, comptype, fileobj, bufsize,

elif comptype == "xz":
try:
import lzma
# TODO: RUSTPYTHON remove underscore
Copy link
Member

Choose a reason for hiding this comment

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

Is this name changed to raise ImportError? What happens if it is lzma?

Copy link
Collaborator Author

@arihant2math arihant2math Apr 30, 2025

Choose a reason for hiding this comment

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

Yes, if left as is everything breaks because lzma is expected to be unimportable.

Copy link
Member

Choose a reason for hiding this comment

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

xz seems to be not support. Added reason and avoided to use fake module name

@youknowone
Copy link
Member

oh no.. I thought #5728 and this one had shared work of the new compression module

@youknowone
Copy link
Member

@arihant2math What will be the best way? Is it worth to keep #5728?
if yes, the conflict need to be resolve.
if not, reverting it and merging this can be a way.

@arihant2math
Copy link
Collaborator Author

Probably easiest to revert, yes.

youknowone and others added 3 commits May 7, 2025 15:01
Signed-off-by: Ashwin Naren <arihant2math@gmail.com>
Signed-off-by: Ashwin Naren <arihant2math@gmail.com>
arihant2math and others added 2 commits May 7, 2025 15:01
Signed-off-by: Ashwin Naren <arihant2math@gmail.com>
@youknowone youknowone merged commit 79646fd into RustPython:main May 7, 2025
19 of 22 checks passed
@arihant2math arihant2math deleted the lzma branch May 7, 2025 16:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants