8000 lzma implementation by arihant2math · Pull Request #5717 · RustPython/RustPython · GitHub
[go: up one dir, main page]

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
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
_lzma implementation and test marking
Signed-off-by: Ashwin Naren <arihant2math@gmail.com>
  • Loading branch information
arihant2math authored and youknowone committed May 7, 2025
commit a5016446f40a1aa7eb2e03b268c754524599a6ec
44 changes: 17 additions & 27 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions Lib/tarfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

import lzma_
except ImportError:
raise CompressionError("lzma module is not available") from None
if mode == "r":
Expand Down Expand Up @@ -1923,7 +1924,8 @@ def xzopen(cls, name, mode="r", fileobj=None, preset=None, **kwargs):
raise ValueError("mode must be 'r', 'w' or 'x'")

try:
from lzma import LZMAFile, LZMAError
# TODO: RUSTPYTHON remove underscore
from lzma_ import LZMAFile, LZMAError
except ImportError:
raise CompressionError("lzma module is not available") from None

Expand Down
10 changes: 6 additions & 4 deletions Lib/test/support/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -494,10 +494,12 @@ def requires_bz2(reason='requires bz2'):
return unittest.skipUnless(bz2, reason)

def requires_lzma(reason='requires lzma'):
try:
import lzma
except ImportError:
lzma = None
# try:
# import lzma
# except ImportError:
# lzma = None
# TODO: RUSTPYTHON
lzma = None
return unittest.skipUnless(lzma, reason)

def has_no_debug_ranges():
Expand Down
Loading
0