Skip to content

Align filesystem archives and bytecode compilation with Python 3.15 - #9191

Draft
youknowdot wants to merge 1 commit into
RustPython:mainfrom
youknowdot:split/filesystem-archive-315
Draft

youknowdot wants to merge 1 commit into
RustPython:mainfrom
youknowdot:split/filesystem-archive-315

Conversation

@youknowdot

Copy link
Copy Markdown
Contributor

Summary

Split the connected filesystem/archive and bytecode-compilation library refresh out of #8954.

  • Update ten production modules from CPython 3.15.0 (d220409a13b77de7a6c30abe16ea90db01528edc): glob, pathlib/_os/types, zipfile/_path/_functools, tempfile, py_compile, and compileall.
  • Keep virtual-path interfaces and archive helpers together. compileall depends on both pathlib.Path and py_compile; PyZipFile uses the same native importlib bytecode writer.
  • Refresh canonical tests through scripts/update_lib, preserving all eight existing RustPython guards. No new skips, expected failures, snippets, or native code changes.

Validation

  • Fresh cargo build --locked --offline --release: passed.
  • test_glob: 22 cases, 2 skipped.
  • test_pathlib: 1,394 selected cases, 407 skipped.
  • test_zipfile: 386 cases, 37 skipped, 4 existing expected failures.
  • test_tempfile: 121 cases, 9 skipped.
  • test_py_compile: 34 cases.
  • test_compileall: 139 selected cases, 6 skipped, 2 existing expected failures.
  • Normal commit hooks and final source/artifact audits: passed.

All six suites passed: 2,096 reported cases, including 461 existing skips and 6 expected failures. Native sources are unchanged; the full Rust workspace/C-API suites were not rerun for this library-only extraction.

Local validation uses a fresh release build from this exact worktree. Normal, -E, and -I startup checks verify that the interpreter and its isolated children use this checkout's Lib. Child cache writes are allowed, then audited and preserved in a separate quarantine; source files remain unchanged.

The local pathlib selection excludes Unix-socket creation. The compileall selection excludes its six inherited real-multiprocessing cases, whose forkserver uses Unix sockets. Existing optional-platform/resource skips remain. The existing CI selections are unchanged. Windows, macOS, and frozen-stdlib behavior are not claimed as locally verified.

The pinned upstream PyZipFile._get_code currently does not forward its stored optimization setting to source_to_code; this PR does not claim to fix that behavior. Existing PyZipFile expected failures are retained.

AI disclosure

OpenAI Codex (model version unavailable) assisted with dependency analysis, updater-driven extraction, independent source review, validation, and this PR description. The commit includes the required Assisted-by trailer.

Refresh the connected pathlib, glob, zipfile, tempfile, py_compile and compileall closure from CPython 3.15.0 while preserving existing RustPython test guards.

Assisted-by: OpenAI Codex:model version unavailable
@coderabbitai

coderabbitai Bot commented Oct 18, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Review was skipped due to path filters

⛔ Files ignored due to path filters: 26
  • Lib/compileall.py is excluded by !Lib/**
  • Lib/glob.py is excluded by !Lib/**
  • Lib/pathlib/__init__.py is excluded by !Lib/**
  • Lib/pathlib/_os.py is excluded by !Lib/**
  • Lib/pathlib/types.py is excluded by !Lib/**
  • Lib/py_compile.py is excluded by !Lib/**
  • Lib/tempfile.py is excluded by !Lib/**
  • Lib/test/test_compileall.py is excluded by !Lib/**
  • Lib/test/test_glob.py is excluded by !Lib/**
  • Lib/test/test_pathlib/support/lexical_path.py is excluded by !Lib/**
  • Lib/test/test_pathlib/support/local_path.py is excluded by !Lib/**
  • Lib/test/test_pathlib/support/zip_path.py is excluded by !Lib/**
  • Lib/test/test_pathlib/test_join.py is excluded by !Lib/**
  • Lib/test/test_pathlib/test_join_windows.py is excluded by !Lib/**
  • Lib/test/test_pathlib/test_pathlib.py is excluded by !Lib/**
  • Lib/test/test_pathlib/test_read.py is excluded by !Lib/**
  • Lib/test/test_pathlib/test_write.py is excluded by !Lib/**
  • Lib/test/test_py_compile.py is excluded by !Lib/**
  • Lib/test/test_tempfile.py is excluded by !Lib/**
  • Lib/test/test_zipfile/__main__.py is excluded by !Lib/**
  • Lib/test/test_zipfile/_path/__init__.py is excluded by !Lib/**
  • Lib/test/test_zipfile/_path/test_path.py is excluded by !Lib/**
  • Lib/test/test_zipfile/test_core.py is excluded by !Lib/**
  • Lib/zipfile/__init__.py is excluded by !Lib/**
  • Lib/zipfile/_path/__init__.py is excluded by !Lib/**
  • Lib/zipfile/_path/_functools.py is excluded by !Lib/**

CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including **/dist/** will override the default block on the dist directory, by removing the pattern from both the lists.

⚙️ Run configuration
  • Configuration used: Repository: RustPython/RustPython/.coderabbit.yml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 165c2c7a-0269-4aae-be90-8bf4db26c669

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • 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

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

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 18, 2026 •

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 ✅ Completed 2026-10-18T11:55:40.286445Z 6a9afbe PR opened
ℹ️ 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.

@youknowdot
youknowdot marked this pull request as draft October 18, 2026 11:51

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6a9afbe374

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread Lib/test/test_glob.py
@@ -393,36 +392,6 @@ def test_glob_many_open_files(self):
for it in iters:
self.assertEqual(next(it), p)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Retain the deleted glob tests

This hunk deletes the complete test_glob0 and test_glob1 cases, but the repository rules explicitly prohibit deleting test lines and limit test-file changes to adding or removing expected-failure markers; preserve the cases (or update their status) instead of dropping their coverage.

AGENTS.md reference: AGENTS.md:L274-L283

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These deletions follow the authorized CPython 3.15 source synchronization rather than removing coverage for retained APIs. The pinned upstream revision removes the deprecated public glob.glob0/glob.glob1 wrappers and their corresponding tests together; the private _glob0/_glob1 implementation helpers remain. Restoring these tests would exercise APIs that no longer exist in Python 3.15. Both files were migrated through scripts/update_lib, preserving the existing RustPython guards. Sources: https://github.com/python/cpython/blob/d220409a13b77de7a6c30abe16ea90db01528edc/Lib/glob.py and https://github.com/python/cpython/blob/d220409a13b77de7a6c30abe16ea90db01528edc/Lib/test/test_glob.py . The candidate glob suite passes locally (22 cases, 2 inherited skips).

Comment thread Lib/tempfile.py
raise

# fullpath is path as seen from the working directory
fullpath = fullname + path[len(name):]

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Normalize byte paths before cleanup recovery

When TemporaryDirectory is constructed with a bytes-valued prefix, suffix, or dir and cleanup enters this PermissionError recovery on POSIX, fd-based shutil.rmtree has decoded its callback path to str while name and fullname remain bytes; this concatenation raises TypeError before ignore_cleanup_errors can apply and leaves the directory behind. Normalize the operands to the same path type before deriving fullpath.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed with a private-filesystem reproduction on both the candidate and CPython 3.15: a bytes-valued TemporaryDirectory dir plus a non-writable child directory makes permission recovery raise TypeError, even with ignore_cleanup_errors=True. The installed CPython tempfile.py and shutil.py match the pinned d220409a13b77de7a6c30abe16ea90db01528edc sources byte-for-byte. The failing concatenation was added in the upstream race-fix backport python/cpython#158431 (original python/cpython#157580). An English upstream bug-report draft with a non-root POSIX reproduction and captured CPython traceback has been prepared for the user; no upstream issue has been filed. Per the requested pinned-source policy, this PR keeps the canonical source unchanged rather than adding a local deviation. This finding is separate from the still-running CI checks.

@github-actions

Copy link
Copy Markdown
Contributor

📦 Library Dependencies

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

:4: SyntaxWarning: invalid decimal literal
:7: SyntaxWarning: "\z" is an invalid escape sequence. Such sequences will not work in the future. Did you mean "\z"? A raw string is also an option.
:10: SyntaxWarning: "\400" is an invalid octal escape sequence. Such sequences will not work in the future. Did you mean "\400"? A raw string is also an option.
:4: SyntaxWarning: invalid decimal literal
:7: SyntaxWarning: "\z" is an invalid escape sequence. Such sequences will not work in the future. Did you mean "\z"? A raw string is also an option.
:10: SyntaxWarning: "\400" is an invalid octal escape sequence. Such sequences will not work in the future. Did you mean "\400"? A raw string is also an option.
:4: SyntaxWarning: invalid decimal literal
:7: SyntaxWarning: "\z" is an invalid escape sequence. Such sequences will not work in the future. Did you mean "\z"? A raw string is also an option.
:10: SyntaxWarning: "\400" is an invalid octal escape sequence. Such sequences will not work in the future. Did you mean "\400"? A raw string is also an option.
[x] lib: cpython/Lib/zipfile
[x] test: cpython/Lib/test/test_zipfile64.py

dependencies:

  • zipfile

dependent tests: (120 tests)

  • zipfile: test_pdb test_pkgutil test_shutil test_zipapp test_zipfile test_zipfile64 test_zipimport test_zipimport_support
    • importlib.metadata: test_importlib test_zoneinfo
    • importlib.resources.readers: test_importlib
      • traceback: test_asyncio test_builtin test_code_module test_contextlib test_contextlib_async test_coroutines test_dictcomps test_exceptions test_http_cookiejar test_importlib test_iter test_listcomps test_pyexpat test_setcomps test_socket test_ssl test_subprocess test_sys test_threadedtempfile test_threading test_traceback test_unittest test_with
    • 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_os test_peepholer test_peg_generator test_py_compile test_reprlib test_sax test_site test_string_literals test_support test_sysconfig test_tarfile test_tempfile test_unicode_file test_venv
      • 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_pyrepl test_runpy test_tomllib test_tools test_unparse test_winapi test_zstd
      • tempfile: test_asyncio test_bytes test_cmd_line test_compile test_concurrent_futures test_cprofile test_csv test_dis test_doctest test_faulthandler test_fileinput test_generated_cases test_genericalias test_hashlib test_importlib test_linecache test_mailbox test_ntpath test_os test_pickle test_pkg test_pstats test_pydoc test_pyrepl test_regrtest test_selectors test_shlex test_sys_settrace test_tabnanny test_termios test_tokenize test_turtle test_urllib test_urllib2 test_urllib_response test_wave test_winconsoleio
      • webbrowser: test_webbrowser

[x] lib: cpython/Lib/compileall.py
[x] test: cpython/Lib/test/test_compileall.py (TODO: 2)

dependencies:

  • compileall

dependent tests: (1 tests)

  • compileall: test_compileall

[x] lib: cpython/Lib/pathlib
[x] test: cpython/Lib/test/test_pathlib

dependencies:

  • pathlib

dependent tests: (171 tests)

  • pathlib: test_ast test_dbm_sqlite3 test_ensurepip test_httpservers test_importlib test_json test_launcher test_logging test_netrc test_os test_pathlib test_peg_generator test_pkgutil test_pyrepl test_runpy test_tarfile test_tempfile test_tomllib test_tools test_traceback test_unparse test_venv test_winapi test_zipapp test_zipfile test_zoneinfo test_zstd
    • compileall: test_compileall
    • importlib: test_asdl_parser test_bdb test_cmd_line_script test_codecs test_ctypes test_doctest test_external_inspection test_frozen test_hashlib test_importlib test_inspect test_linecache test_modulefinder test_multiprocessing_main_handling test_py_compile test_pyclbr test_pydoc test_reprlib test_sundry test_support test_unittest test_zipfile test_zipimport test_zoneinfo
      • ctypes.util: test_ctypes
      • idlelib: test_idle
      • inspect: test_abc test_argparse test_asyncgen test_buffer test_builtin test_clinic test_code test_collections test_coroutines test_decimal test_enum test_functools test_generators test_grammar test_monitoring test_ntpath test_operator test_patma test_posixpath test_signal test_sqlite3 test_turtle test_type_annotations test_type_params test_types test_typing test_unittest test_yield_from test_zipimport_support
      • profile: test_profile
      • py_compile: test_importlib
      • sysconfig: test_c_locale_coercion test_cmd_line test_dtrace test_embed test_gc test_importlib test_os test_osx_env test_pyexpat test_regrtest test_site test_ssl test_subprocess test_sys test_sysconfig test_time test_tools test_urllib2net
      • traceback: test_asyncio test_code_module test_contextlib test_contextlib_async test_dictcomps test_exceptions test_http_cookiejar test_iter test_listcomps test_setcomps test_socket test_threadedtempfile test_threading test_unittest test_with
      • zipfile: test_pdb test_shutil test_zipfile test_zipfile64
      • zipimport: test_importlib
    • traceback:
      • concurrent.futures.interpreter: test_concurrent_futures
      • concurrent.futures.process: test_concurrent_futures
      • http.cookiejar: test_urllib2
      • logging: test_asyncio test_genericalias
      • multiprocessing: test_asyncio test_concurrent_futures test_fcntl test_memoryview test_re
      • socketserver: test_imaplib test_socketserver test_wsgiref
      • threading: test_android test_asyncio test_bytes test_bz2 test_concurrent_futures test_context test_ctypes test_docxmlrpc test_email test_enumerate test_fork1 test_frame test_ftplib test_httplib test_importlib test_io test_ioctl test_itertools test_opcache test_poll test_poplib test_pyrepl test_queue test_robotparser test_sched test_smtplib test_super test_syslog test_termios test_threading_local test_urllib2_localnet test_weakref test_winreg test_xmlrpc
      • timeit: test_timeit

[x] lib: cpython/Lib/tempfile.py
[x] test: cpython/Lib/test/test_tempfile.py (TODO: 1)

dependencies:

  • tempfile

dependent tests: (95 tests)

  • tempfile: test_argparse test_ast test_asyncio test_bytes test_bz2 test_cmd_line test_compile test_compileall test_concurrent_futures test_contextlib test_cprofile test_csv test_ctypes test_dis test_doctest test_embed test_ensurepip test_faulthandler test_filecmp test_fileinput test_generated_cases test_genericalias test_hashlib test_httpservers test_importlib test_inspect test_launcher test_linecache test_logging test_mailbox test_modulefinder test_ntpath test_os test_pathlib test_peg_generator test_pickle test_pkg test_pkgutil test_pstats test_py_compile test_pydoc test_pyrepl test_regrtest test_runpy test_selectors test_shlex test_shutil test_site test_socket test_string_literals test_subprocess test_support test_sys test_sys_settrace test_tabnanny test_tempfile test_termios test_threadedtempfile test_tokenize test_tomllib test_traceback test_turtle test_urllib test_urllib2 test_urllib_response test_venv test_wave test_winconsoleio test_zipapp test_zipfile test_zipfile64 test_zoneinfo test_zstd
    • ctypes.util: test_ctypes
    • multiprocessing.synchronize:
      • concurrent.futures.process: test_concurrent_futures
    • multiprocessing.util: test_asyncio test_concurrent_futures
    • pdb: test_pdb
    • urllib.request: test_http_cookiejar test_sax test_ssl test_urllib2_localnet test_urllib2net test_urllibnet
      • pathlib: test_dbm_sqlite3 test_importlib test_json test_netrc test_pathlib test_tarfile test_tomllib test_tools test_unparse test_winapi test_zipfile

[x] lib: cpython/Lib/glob.py
[x] test: cpython/Lib/test/test_glob.py

dependencies:

  • glob

dependent tests: (81 tests)

  • glob: test_bz2 test_glob test_mailbox test_regrtest test_site test_tokenize test_unicode_file test_zipimport
    • pathlib: test_ast test_dbm_sqlite3 test_ensurepip test_httpservers test_importlib test_json test_launcher test_logging test_netrc test_os test_pathlib test_peg_generator test_pkgutil test_pyrepl test_runpy test_tarfile test_tempfile test_tomllib test_tools test_traceback test_unparse test_venv test_winapi test_zipapp test_zipfile test_zoneinfo test_zstd
      • compileall: test_compileall
      • importlib: test_asdl_parser test_bdb test_cmd_line_script test_codecs test_ctypes test_doctest test_external_inspection test_frozen test_hashlib test_importlib test_inspect test_linecache test_modulefinder test_multiprocessing_main_handling test_py_compile test_pyclbr test_pydoc test_reprlib test_sundry test_support test_unittest test_zipfile test_zoneinfo
      • traceback: test_asyncio test_builtin test_code_module test_contextlib test_contextlib_async test_coroutines test_dictcomps test_exceptions test_http_cookiejar test_iter test_listcomps test_pyexpat test_setcomps test_socket test_ssl test_subprocess test_sys test_threadedtempfile test_threading test_unittest test_with
      • zipapp: test_pdb

[x] lib: cpython/Lib/py_compile.py
[x] test: cpython/Lib/test/test_py_compile.py (TODO: 1)

dependencies:

  • py_compile

dependent tests: (46 tests)

  • py_compile: test_argparse test_cmd_line_script test_compileall test_importlib test_modulefinder test_multiprocessing_main_handling test_py_compile test_pydoc test_runpy
    • zipfile: test_pdb test_pkgutil test_shutil test_zipapp test_zipfile test_zipfile64 test_zipimport test_zipimport_support
      • importlib.metadata: test_importlib test_zoneinfo
      • importlib.resources.readers: test_importlib
      • shutil: test_bz2 test_ctypes test_embed test_filecmp test_glob test_httpservers test_importlib test_inspect test_io test_launcher test_logging test_os test_peepholer test_peg_generator test_reprlib test_sax test_site test_string_literals test_subprocess test_support test_sysconfig test_tarfile test_tempfile test_traceback test_unicode_file test_venv

Legend:

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

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.

1 participant