Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

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
more diff-friendly disabling xz
  • Loading branch information
youknowone committed May 7, 2025
commit acae154f1b1f4ad95a477ddf26d7644dc45aefa7
13 changes: 9 additions & 4 deletions 13 Lib/tarfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -392,10 +392,13 @@ def __init__(self, name, mode, comptype, fileobj, bufsize,

elif comptype == "xz":
try:
# TODO: RUSTPYTHON remove underscore
import lzma_
import lzma
except ImportError:
raise CompressionError("lzma module is not available") from None

# XXX: RUSTPYTHON; xz is not supported yet
raise CompressionError("lzma module is not available") from None

if mode == "r":
self.dbuf = b""
self.cmp = lzma.LZMADecompressor()
Expand Down Expand Up @@ -1924,11 +1927,13 @@ def xzopen(cls, name, mode="r", fileobj=None, preset=None, **kwargs):
raise ValueError("mode must be 'r', 'w' or 'x'")

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

# XXX: RUSTPYTHON; xz is not supported yet
raise CompressionError("lzma module is not available") from None

fileobj = LZMAFile(fileobj or name, mode, preset=preset)

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

def requires_lzma(reason='requires lzma'):
# try:
# import lzma
# except ImportError:
# lzma = None
# TODO: RUSTPYTHON
try:
import lzma
except ImportError:
lzma = None
# XXX: RUSTPYTHON; xz is not supported yet
lzma = None
return unittest.skipUnless(lzma, reason)

Expand Down
6 changes: 3 additions & 3 deletions 6 Lib/test/test_tarfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@
except ImportError:
bz2 = None
try:
# TODO: RUSTPYTHON
lzma = None
# import lzma
import lzma
except ImportError:
lzma = None
# XXX: RUSTPYTHON; xz is not supported yet
lzma = None

def sha256sum(data):
return sha256(data).hexdigest()
Expand Down
Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.