Skip to content

Align LZMA compressor and filter validation - #9582

Merged
youknowone merged 3 commits into
RustPython:mainfrom
youknowdot:fix/lzma-validation-20261103
Nov 4, 2026
Merged

youknowone merged 3 commits into
RustPython:mainfrom
youknowdot:fix/lzma-validation-20261103

Conversation

@youknowdot

Copy link
Copy Markdown
Contributor

Summary

  • Raise ValueError for incompatible compressor integrity checks and simultaneous preset/filter arguments, as CPython does.
  • Validate _encode_filter_properties filter option names, numeric fields and preset before encoding. Preserve the argument parser's count check, conversion order and subsequent unknown-key rejection.
  • Leave the compression engine and flush lifecycle unchanged. This is independent of the engine-port work in common: port the lzma engine to xz-core #8639, whose stdlib changes address the filter-chain length limit.

Validation

  • Source-reviewed against CPython 3.15 Modules/_lzmamodule.c.
  • prek run --files crates/stdlib/src/lzma.rs, git diff --check, and normal commit hooks passed.
  • Native RustPython compilation and execution were not run locally; hosted CI is required. Existing test_lzma expected-failure markers remain pending exact runtime evidence; a newly passing marked case may appear as an unexpected success.

Scope

This does not claim complete LZMA compatibility: existing dict-like mapping support, some error ordering and backend validation/error mapping remain separate. In particular, this does not alter the backend finish loop. The local xz API documents repeating Finish until StreamEnd; whether an existing single-threaded path can return early with spare output is not established here.

Use CPython exception types for incompatible compressor options and validate filter properties with the keyword parser ordering, including mutation during index conversion.

Assisted-by: OpenAI Codex:model version not exposed
@coderabbitai

coderabbitai Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Caution

Review failed

The pull request is closed.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Assisted-by: OpenAI Codex:model version not exposed
Apply update_lib.cmd_auto_mark.apply_test_changes to the two repeated unexpected successes observed in the exact-head Ubuntu CI run. Preserve all test bodies and assertions.

Assisted-by: OpenAI Codex:model version unavailable
@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

📦 Library Dependencies

The following Lib/ modules were modified. Here are their dependencies:

[x] lib: cpython/Lib/lzma.py
[x] test: cpython/Lib/test/test_lzma.py (TODO: 3)

dependencies:

  • lzma

dependent tests: (118 tests)

  • lzma: test_free_threading test_lzma test_tarfile
    • shutil: test_argparse test_bz2 test_compileall test_ctypes test_embed test_filecmp test_glob test_httpservers test_importlib test_inspect test_io test_launcher test_logging test_modulefinder test_multiprocessing_forkserver test_os test_peepholer test_peg_generator test_pkgutil test_profiling test_py_compile test_reprlib test_sax test_shutil test_site test_string_literals test_subprocess test_support test_sys test_sysconfig test_tempfile test_traceback test_unicode_file test_venv test_zoneinfo
      • argparse: test_profiling
      • ctypes.util: test_ctypes
      • ensurepip: test_ensurepip
      • http.server: test_robotparser test_urllib2_localnet test_xmlrpc
      • multiprocessing.util: test_asyncio test_concurrent_futures
      • pathlib: test_ast test_dbm_sqlite3 test_importlib test_json test_netrc test_pathlib test_profiling test_pyrepl test_runpy test_tomllib test_tools test_unparse test_winapi test_zipapp test_zipfile test_zstd
      • tempfile: test_asyncio test_bytes test_cmd_line test_compile test_concurrent_futures test_contextlib test_csv test_curses test_dis test_doctest test_dtrace test_faulthandler test_fileinput test_free_threading test_generated_cases test_genericalias test_hashlib test_importlib test_interpreters test_linecache test_mailbox test_ntpath test_os test_pickle test_pickletools test_pkg test_profiling test_pstats test_pydoc test_pyrepl test_readline test_regrtest test_selectors test_shlex test_socket test_source_encoding test_sys_settrace test_tabnanny test_termios test_threadedtempfile test_tokenize test_turtle test_urllib test_urllib2 test_urllib_response test_wave test_winconsoleio test_zipfile test_zipfile64
      • uuid: test_free_threading
      • webbrowser: test_webbrowser
      • zipapp: test_pdb
      • zipfile: test_zipfile test_zipimport test_zipimport_support
    • zipfile:
      • importlib.metadata: test_importlib

Legend:

  • [+] path exists in CPython
  • [x] up-to-date, [ ] outdated

@youknowone
youknowone marked this pull request as ready for review November 4, 2026 22:17
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-11-04T22:17:16.664264Z
We couldn’t complete this review. Comment @codex review to try again.
164bb2f Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@youknowone
youknowone merged commit b15d7bc into RustPython:main Nov 4, 2026
21 checks passed
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

1 similar comment
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants