Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-115988: Add missing ARM64 and RISCV filter in lzma module #115989

Open
wants to merge 20 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
44 changes: 38 additions & 6 deletions Doc/library/lzma.rst
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,27 @@ Miscellaneous

.. _filter-chain-specs:
gpshead marked this conversation as resolved.
Show resolved Hide resolved


Information about the version of the lzma library in use is available through
the following constants:


.. data:: LZMA_VERSION

The version string of the lzma library that was used for building the module.
This may be different from the lzma library actually used at runtime, which
is available as :const:`LZMA_RUNTIME_VERSION`.

.. versionadded:: 3.13


.. data:: LZMA_RUNTIME_VERSION

The version string of the lzma library actually loaded by the interpreter.

.. versionadded:: 3.13


Specifying custom filter chains
-------------------------------

Expand All @@ -343,12 +364,23 @@ options. Valid filter IDs are as follows:

* Branch-Call-Jump (BCJ) filters:

* :const:`FILTER_X86`
* :const:`FILTER_IA64`
* :const:`FILTER_ARM`
* :const:`FILTER_ARMTHUMB`
* :const:`FILTER_POWERPC`
* :const:`FILTER_SPARC`
* :const:`!FILTER_X86`
* :const:`!FILTER_IA64`
* :const:`!FILTER_ARM`
* :const:`!FILTER_ARMTHUMB`
* :const:`!FILTER_POWERPC`
* :const:`!FILTER_SPARC`
* :const:`!FILTER_ARM64`

Only works if lzma runtime library version is 5.4.0 or later.

.. versionadded:: 3.13

* :const:`!FILTER_RISCV`

Only works if lzma runtime library version is 5.6.0 or later.

.. versionadded:: 3.13

A filter chain can consist of up to 4 filters, and cannot be empty. The last
filter in the chain must be a compression filter, and any other filters must be
Expand Down
14 changes: 14 additions & 0 deletions Doc/whatsnew/3.13.rst
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,20 @@
than the specified batch size.
(Contributed by Raymond Hettinger in :gh:`113202`.)

lzma
----

* Add :const:`lzma.LZMA_VERSION` and :const:`lzma.LZMA_RUNTIME_VERSION`. The former
reports the version string of the underlying ``lzma`` library during build while
the later reports runtime version.
(Contributed by Chien Wong in :gh:`115988`.)

* Add support of new BCJ filters ARM64 and RISC-V via :const:`lzma.FILTER_ARM64` and

Check warning on line 340 in Doc/whatsnew/3.13.rst

View workflow job for this annotation

GitHub Actions / Docs / Docs

py:const reference target not found: lzma.FILTER_ARM64

Check warning on line 340 in Doc/whatsnew/3.13.rst

View workflow job for this annotation

GitHub Actions / Docs / Docs

py:const reference target not found: lzma.FILTER_RISCV
:const:`lzma.FILTER_RISCV`.
Note that the new filters will work only if runtime library supports them. ARM64 filter
requires ``lzma`` 5.4.0 or newer while RISC-V requires 5.6.0 or newer.
(Contributed by Chien Wong in :gh:`115988`.)

marshal
-------

Expand Down
1 change: 1 addition & 0 deletions Lib/lzma.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"CHECK_ID_MAX", "CHECK_UNKNOWN",
"FILTER_LZMA1", "FILTER_LZMA2", "FILTER_DELTA", "FILTER_X86", "FILTER_IA64",
"FILTER_ARM", "FILTER_ARMTHUMB", "FILTER_POWERPC", "FILTER_SPARC",
"FILTER_ARM64", "FILTER_RISCV",
"FORMAT_AUTO", "FORMAT_XZ", "FORMAT_ALONE", "FORMAT_RAW",
"MF_HC3", "MF_HC4", "MF_BT2", "MF_BT3", "MF_BT4",
"MODE_FAST", "MODE_NORMAL", "PRESET_DEFAULT", "PRESET_EXTREME",
Expand Down