Skip to content
Open
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
2 changes: 2 additions & 0 deletions Doc/library/lzma.rst
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,8 @@ options. Valid filter IDs are as follows:
* :const:`FILTER_ARMTHUMB`
* :const:`FILTER_POWERPC`
* :const:`FILTER_SPARC`
* :const:`FILTER_ARM64`
* :const:`FILTER_RISCV`

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
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
16 changes: 15 additions & 1 deletion Modules/_lzmamodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@
#error "The maximum block size accepted by liblzma is SIZE_MAX."
#endif


#ifndef LZMA_FILTER_ARM64
#define LZMA_FILTER_ARM64 LZMA_VLI_C(0x0A)
#endif
#ifndef LZMA_FILTER_RISCV
#define LZMA_FILTER_RISCV LZMA_VLI_C(0x0B)
#endif

/* On success, return value >= 0
On failure, return -1 */
static inline Py_ssize_t
Expand Down Expand Up @@ -372,6 +380,8 @@ lzma_filter_converter(_lzma_state *state, PyObject *spec, void *ptr)
case LZMA_FILTER_ARM:
case LZMA_FILTER_ARMTHUMB:
case LZMA_FILTER_SPARC:
case LZMA_FILTER_ARM64:
case LZMA_FILTER_RISCV:
f->options = parse_filter_spec_bcj(state, spec);
return f->options != NULL;
default:
Expand Down Expand Up @@ -490,7 +500,9 @@ build_filter_spec(const lzma_filter *f)
case LZMA_FILTER_IA64:
case LZMA_FILTER_ARM:
case LZMA_FILTER_ARMTHUMB:
case LZMA_FILTER_SPARC: {
case LZMA_FILTER_SPARC:
case LZMA_FILTER_ARM64:
case LZMA_FILTER_RISCV: {
lzma_options_bcj *options = f->options;
if (options) {
ADD_FIELD(options, start_offset);
Expand Down Expand Up @@ -1551,6 +1563,8 @@ lzma_exec(PyObject *module)
ADD_INT_PREFIX_MACRO(module, FILTER_ARMTHUMB);
ADD_INT_PREFIX_MACRO(module, FILTER_SPARC);
ADD_INT_PREFIX_MACRO(module, FILTER_POWERPC);
ADD_INT_PREFIX_MACRO(module, FILTER_ARM64);
ADD_INT_PREFIX_MACRO(module, FILTER_RISCV);
ADD_INT_PREFIX_MACRO(module, MF_HC3);
ADD_INT_PREFIX_MACRO(module, MF_HC4);
ADD_INT_PREFIX_MACRO(module, MF_BT2);
Expand Down