◐ Shell
clean mode source ↗

lzma implementation by arihant2math · Pull Request #5717 · RustPython/RustPython

@arihant2math

Based on #5709 because of the zlib abstraction.

@arihant2math

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

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

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

@arihant2math

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

youknowone

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

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?

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.

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

@youknowone

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

@youknowone

@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

Probably easiest to revert, yes.

Signed-off-by: Ashwin Naren <arihant2math@gmail.com>
Signed-off-by: Ashwin Naren <arihant2math@gmail.com>
Signed-off-by: Ashwin Naren <arihant2math@gmail.com>