Skip to content

Add _lzma.CHECK_ID_MAX and remove duplicate _os.{SEEK_CUR,SEEK_END}#7156

Merged
youknowone merged 1 commit into
RustPython:mainfrom
moreal:fix/fail-all-test-all
Feb 15, 2026
Merged

Add _lzma.CHECK_ID_MAX and remove duplicate _os.{SEEK_CUR,SEEK_END}#7156
youknowone merged 1 commit into
RustPython:mainfrom
moreal:fix/fail-all-test-all

Conversation

@moreal
Copy link
Copy Markdown
Contributor

@moreal moreal commented Feb 15, 2026

This pull request ensures that the tests checking whether each module correctly defines __all__ now pass.

First, I resolved an issue in the Lib/os.py module where SEEK_CUR and SEEK_END were being defined and used while also being provided by _os.

Additionally, I defined CHECK_ID_MAX, which was previously undefined in _lzma. I also updated CHECK_UNKNOWN to use the value CHECK_ID_MAX + 1, consistent with the CPython implementation.

#define LZMA_CHECK_UNKNOWN (LZMA_CHECK_ID_MAX + 1)

Summary by CodeRabbit

  • Refactor
    • Reorganized constant definitions for improved code maintainability.
    • Optimized standard library imports to streamline internal dependencies.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Feb 15, 2026

📝 Walkthrough

Walkthrough

Two constant refactorings across stdlib modules: the LZMA module introduces CHECK_ID_MAX and restructures CHECK_UNKNOWN to depend on it, while the OS module removes imports of seek-related constants.

Changes

Cohort / File(s) Summary
LZMA Constants Restructuring
crates/stdlib/src/lzma.rs
Added new constant CHECK_ID_MAX = 15 and refactored CHECK_UNKNOWN from hardcoded 16 to computed value CHECK_ID_MAX + 1 with #[pyattr] annotation.
OS Module Imports Cleanup
crates/vm/src/stdlib/os.rs
Removed SEEK_CUR, SEEK_END, and SEEK_SET from the libc import set under #[pyattr]; other file I/O constants remain imported.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Suggested reviewers

  • youknowone

Poem

🐰 Two constants now dance in harmony fine,
CHECK_ID bounds the maximum line,
And seek constants hop away from the fold,
As the rabbit refactors the imports of old! 📚✨

🚥 Pre-merge checks | ✅ 3 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Merge Conflict Detection ⚠️ Warning ❌ Merge conflicts detected (6 files):

⚔️ Lib/test/test___all__.py (content)
⚔️ Lib/test/test_configparser.py (content)
⚔️ Lib/test/test_lzma.py (content)
⚔️ Lib/test/test_urllib2_localnet.py (content)
⚔️ crates/stdlib/src/lzma.rs (content)
⚔️ crates/vm/src/stdlib/os.rs (content)

These conflicts must be resolved before merging into main.
Resolve conflicts locally and push changes to this branch.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes both main changes: adding CHECK_ID_MAX to _lzma and removing duplicate SEEK constants from _os. It is concise, specific, and directly reflects the changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
⚔️ Resolve merge conflicts (beta)
  • Auto-commit resolved conflicts to branch fix/fail-all-test-all
  • Post resolved changes as copyable diffs in a comment

No actionable comments were generated in the recent review. 🎉


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

Comment @coderabbitai help to get the list of available commands and usage tips.

@moreal moreal self-assigned this Feb 15, 2026
@moreal moreal force-pushed the fix/fail-all-test-all branch from 42c3d22 to c942941 Compare February 15, 2026 08:18
@github-actions
Copy link
Copy Markdown
Contributor

📦 Library Dependencies

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

[x] test: cpython/Lib/test/test___all__.py

dependencies:

dependent tests: (no tests depend on all)

[x] lib: cpython/Lib/codecs.py
[ ] test: cpython/Lib/test/test_codecs.py (TODO: 11)
[ ] test: cpython/Lib/test/test_codeccallbacks.py (TODO: 9)
[x] test: cpython/Lib/test/test_codecencodings_cn.py (TODO: 4)
[x] test: cpython/Lib/test/test_codecencodings_hk.py (TODO: 1)
[x] test: cpython/Lib/test/test_codecencodings_iso2022.py (TODO: 5)
[x] test: cpython/Lib/test/test_codecencodings_jp.py (TODO: 7)
[x] test: cpython/Lib/test/test_codecencodings_kr.py (TODO: 3)
[x] test: cpython/Lib/test/test_codecencodings_tw.py (TODO: 1)
[ ] test: cpython/Lib/test/test_codecmaps_cn.py (TODO: 3)
[ ] test: cpython/Lib/test/test_codecmaps_hk.py (TODO: 1)
[ ] test: cpython/Lib/test/test_codecmaps_jp.py (TODO: 6)
[ ] test: cpython/Lib/test/test_codecmaps_kr.py (TODO: 3)
[ ] test: cpython/Lib/test/test_codecmaps_tw.py (TODO: 3)
[ ] test: cpython/Lib/test/test_charmapcodec.py
[ ] test: cpython/Lib/test/test_multibytecodec.py

dependencies:

  • codecs

dependent tests: (124 tests)

  • codecs: test_charmapcodec test_codeccallbacks test_codecs test_eof test_exceptions test_importlib test_io test_json test_locale test_logging test_os test_plistlib test_str test_sys
    • encodings:
      • locale: test__locale test_builtin test_c_locale_coercion test_calendar test_decimal test_format test_re test_regrtest test_types test_utf8_mode
    • json: test_subprocess test_sysconfig test_tomllib test_tools test_traceback test_zoneinfo
      • importlib.metadata: test_importlib
    • pickle: test_annotationlib test_array test_asyncio test_bytes test_bz2 test_collections test_concurrent_futures test_coroutines test_csv test_ctypes test_defaultdict test_deque test_descr test_dict test_dictviews test_email test_enum test_enumerate test_fractions test_functools test_generators test_genericalias test_http_cookies test_inspect test_ipaddress test_iter test_itertools test_list test_lzma test_memoryio test_memoryview test_opcache test_operator test_ordered_dict test_pathlib test_pickle test_pickletools test_platform test_positional_only_arg test_posix test_random test_range test_set test_shelve test_slice test_socket test_statistics test_string test_trace test_tuple test_type_aliases test_type_params test_typing test_unittest test_uuid test_xml_dom_minicompat test_xml_etree test_zipfile test_zlib test_zoneinfo
      • logging.handlers: test_concurrent_futures
    • tokenize: test_linecache test_tabnanny test_tokenize test_unparse
      • inspect: test_abc test_argparse test_asyncgen test_buffer test_code test_grammar test_ntpath test_patma test_posixpath test_pydoc test_signal test_type_annotations test_yield_from test_zipimport
      • traceback: test_asyncio test_code_module test_contextlib test_contextlib_async test_dictcomps test_importlib test_listcomps test_pyexpat test_setcomps test_ssl test_threadedtempfile test_threading test_unittest test_with

[x] lib: cpython/Lib/configparser.py
[x] test: cpython/Lib/test/test_configparser.py (TODO: 1)

dependencies:

  • configparser

dependent tests: (2 tests)

  • configparser: test_configparser test_logging

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

dependencies:

  • lzma

dependent tests: (1 tests)

  • lzma: test_lzma

[x] lib: cpython/Lib/urllib
[x] test: cpython/Lib/test/test_urllib.py
[x] test: cpython/Lib/test/test_urllib2.py
[x] test: cpython/Lib/test/test_urllib2_localnet.py (TODO: 19)
[x] test: cpython/Lib/test/test_urllib2net.py
[x] test: cpython/Lib/test/test_urllibnet.py
[x] test: cpython/Lib/test/test_urlparse.py
[x] test: cpython/Lib/test/test_urllib_response.py
[x] test: cpython/Lib/test/test_robotparser.py

dependencies:

  • urllib

dependent tests: (27 tests)

  • urllib: test_genericalias test_http_cookiejar test_httpservers test_logging test_pathlib test_pydoc test_robotparser test_site test_sqlite3 test_ssl test_ucn test_urllib test_urllib2 test_urllib2_localnet test_urllib2net test_urllib_response test_urllibnet test_urlparse
    • email.utils: test_email test_smtplib
      • smtplib: test_smtpnet
    • http.client: test_docxmlrpc test_hashlib test_unicodedata test_wsgiref test_xmlrpc
    • pydoc: test_enum

Legend:

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

@moreal moreal marked this pull request as ready for review February 15, 2026 09:03
@youknowone youknowone merged commit 914634e into RustPython:main Feb 15, 2026
14 checks passed
youknowone pushed a commit to youknowone/RustPython that referenced this pull request Mar 22, 2026
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