Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork32.4k
gh-115988: Add missing ARM64 and RISCV filter in lzma module#115989
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Open
ivq wants to merge24 commits intopython:mainChoose a base branch fromivq:xz_bcj_filters
base:main
Could not load branches
Branch not found:{{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline, and old review comments may become outdated.
Uh oh!
There was an error while loading.Please reload this page.
Open
Changes from20 commits
Commits
Show all changes
24 commits Select commitHold shift + click to select a range
68979bc
Add missing ARM64 and RISCV filter in lzma module
ivq3fa0c17
Suppress doc warning "py:const reference target not found"
ivqc1e166a
Add lzma version
ivqea51476
Add ARM64, RISC-V filter test case
ivq6189ceb
Update lzma doc
ivq0f6fd63
Add NEWS entry
ivq9731225
Optimise NEWS
ivq40e9d34
Move version doc section
ivq8c922f7
Add WHATSNEW entry
ivq9cd4cb8
Fix filter chain specs position
ivq8a85c48
Suppress doc warning
ivq32725a7
Elide upstream binary data from the test.
gpshead6d94a08
Clarify the documentation a bit.
gpsheadc62ca63
Clarifying comment, docs accuracy.
gpshead045aa40
Expose the version as a number.
gpshead8f49f69
Merge branch 'main' into xz_bcj_filters
gpshead832335d
minor version explanation tweak.
gpshead728f286
Adjust the whats new text.
gpshead61c4adf
NEWS wording and formatting tweak.
gpshead98adeee
line length
gpshead449b722
Merge remote-tracking branch 'origin/main' into xz_bcj_filters
ivqf381ca5
We've missed the 3.13 window
ivq9f0d4d4
Fix accidentally removed newline when merging remote main
ivq1a17fd5
Remove unused import
ivqFile filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
59 changes: 53 additions & 6 deletionsDoc/library/lzma.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletionsDoc/whatsnew/3.13.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletionsLib/lzma.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletionsLib/test/test_lzma.py
gpshead marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletionsMisc/NEWS.d/next/Library/2024-03-17-22-16-53.gh-issue-115988.EshSDM.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
:mod:`lzma` gains C library version info constants and adds constants to | ||
support the newer BCJ filters for ARM64 and RISC-V. |
42 changes: 41 additions & 1 deletionModules/_lzmamodule.c
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -24,6 +24,19 @@ | ||
#error "The maximum block size accepted by liblzma is SIZE_MAX." | ||
#endif | ||
/* | ||
* If the lzma.h we're building against is so old as not to define these, this | ||
* provides their equivalent values so that the names remain defined in Python | ||
* regardless of the header versions used at build time. | ||
*/ | ||
#ifndef LZMA_FILTER_ARM64 | ||
gpshead marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
#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 | ||
@@ -372,6 +385,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: | ||
gpshead marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
f->options = parse_filter_spec_bcj(state, spec); | ||
return f->options != NULL; | ||
default: | ||
@@ -490,7 +505,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_ARM64: | ||
case LZMA_FILTER_RISCV: { | ||
lzma_options_bcj *options = f->options; | ||
if (options) { | ||
ADD_FIELD(options, start_offset); | ||
@@ -1551,6 +1568,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); | ||
@@ -1591,6 +1610,27 @@ lzma_exec(PyObject *module) | ||
return -1; | ||
} | ||
if (PyModule_AddStringConstant( | ||
module, "LZMA_HEADER_VERSION_STRING", | ||
LZMA_VERSION_STRING) < 0) { | ||
return -1; | ||
} | ||
if (PyModule_AddStringConstant( | ||
module, "LZMA_VERSION_STRING", | ||
lzma_version_string()) < 0) { | ||
return -1; | ||
} | ||
PyObject *uint32_obj = PyLong_FromUnsignedLong(LZMA_VERSION); | ||
if (PyModule_AddObject(module, "LZMA_HEADER_VERSION", uint32_obj) < 0) { | ||
Py_XDECREF(uint32_obj); | ||
return -1; | ||
} | ||
uint32_obj = PyLong_FromUnsignedLong(lzma_version_number()); | ||
if (PyModule_AddObject(module, "LZMA_VERSION", uint32_obj) < 0) { | ||
Py_XDECREF(uint32_obj); | ||
return -1; | ||
} | ||
return 0; | ||
} | ||
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.