Skip to content

Prepare Python 3.15 with rc3 libraries and native prerequisites - #8954

Draft
youknowdot wants to merge 73 commits into
RustPython:mainfrom
youknowdot:cpython-315-mega-integration
Draft

youknowdot wants to merge 73 commits into
RustPython:mainfrom
youknowdot:cpython-315-mega-integration

Conversation

@youknowdot

@youknowdot youknowdot commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Develop the Python 3.15 integration against official CPython v3.15.0, commit d220409a13b77de7a6c30abe16ea90db01528edc.

This remains the broad integration PR for startup/import/venv, standard libraries and their canonical tests, and native language/runtime prerequisites. The smaller target-transition work is tracked separately in #8950.

Current head: cc05fc838033d49d53ed8770baaf351165aa94f7.

The final-reference refresh:

  • Copies ten library/test files exactly from the final source.
  • Updates comparison pins, the library-upgrade workflow pins, and C-API export-generation provenance.
  • Preserves the existing export names, runtime alpha status, and implemented bytecode magic.

Verification for this update

  • Exact source-file comparisons, export generation and consistency checks, and normal commit hooks passed.
  • The changed YAML workflows passed the offline Zizmor scan.
  • Cargo builds, runtime suites, GUI/Android tests, and other platform validation have not been rerun for this head.

Remaining limits

Lib/test/test_external_inspection.py remains unchanged from the previous migration, so the final-source migration is incomplete. This draft does not establish complete Python 3.15 runtime or platform compatibility.

Known unresolved areas include bytes.hex boundary handling, grapheme iteration, code-object filename marshalling, and some ctypes ownership paths. This source-reference refresh does not resolve or revalidate them.

The PR currently has conflicts with main. It is not ready to merge.

AI assistance

Prepared with OpenAI Codex under the requesting maintainer's direction. The runtime does not expose an exact model identifier; commits disclose that limitation.

@coderabbitai

coderabbitai Bot commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • 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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

don't add duplicated tests from Lib/test

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.

Aligned this file with the complete snippet already merged in #8947 (43065e7). There is now no snippet diff against current main, and the merged coverage is preserved. The CPython 3.15.0 reference run and commit hooks passed; the mega branch native suite has not been rerun for this test-only alignment.

@youknowdot youknowdot changed the title Prepare Python 3.15 with the rc2 standard library and runtime prerequisites Prepare Python 3.15 with rc3 libraries and native prerequisites Oct 4, 2026
@youknowdot
youknowdot force-pushed the cpython-315-mega-integration branch from fb0f7b6 to 85d2fb9 Compare October 4, 2026 12:26
@youknowdot
youknowdot force-pushed the cpython-315-mega-integration branch 2 times, most recently from 1aba241 to 16a2ef9 Compare October 5, 2026 01:42
@codspeed

codspeed Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Merging this PR will improve performance by ×6.3

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

⚡ 2 improved benchmarks
✅ 60 untouched benchmarks
⏩ 4 skipped benchmarks1

Performance Changes

Benchmark BASE HEAD Efficiency
⚡ base64.py[rustpython] 742.7 ms 31.7 ms ×23
⚡ rustpython[20000] 14.5 ms 8.7 ms +68.05%

Tip

Curious why performance improved? Comment @codspeedbot explain why performance improved on this PR, or directly use the CodSpeed MCP with your agent.


Comparing youknowdot:cpython-315-mega-integration (70e0699) with main (3e0e401)

Open in CodSpeed

Footnotes

  1. 4 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

@youknowdot
youknowdot force-pushed the cpython-315-mega-integration branch 5 times, most recently from ae099f7 to 06d106b Compare October 8, 2026 01:02
youknowdot and others added 14 commits October 8, 2026 18:16
Add unique sentinel values with copy/pickle identity, caller module capture, union support, and cycle collection. Compare constructor behavior and six upstream tests with CPython v3.15.0rc2; retain the existing Python target and bundled libraries.

Assisted-by: Codex:model-version-unavailable
Expose _imp._set_lazy_attributes(modobj, name, /), used by CPython 3.15 importlib after eager loading. Match its empty pending-lazy-module registry behavior, including name type and string-subclass hashing checks. This does not implement lazy imports or change the target version or bundled libraries.

Assisted-by: Codex:model-version-unavailable
Add Python 3.15 compile(module=...) warning filtering. Move format-spec diagnostics to a fallible, literal-aware AST boundary; preserve nested literal warnings while excluding raw text and comments, map function-type fragments to source locations, and suppress duplicate type-comment emissions with per-call tracking.

Keep unrelated legacy warning-detection and exact diagnostic metadata gaps documented by differential probes. Add focused flag, source-location, exception, reentrancy, filtering and literal-boundary regression coverage.

Assisted-by: Codex:model-version-unavailable
Target Python 3.15.0alpha and import site, pkgutil, importlib and supporting test libraries from CPython v3.15.0rc2 (435c9e5a798c99653e3ab64ce29baed0e4f3dfee). Keep native atomic module-cache movement at the surviving importlib reorder sites and use the canonical builtin import callback. Preserve explicit temporary eager-import and readonly-table adaptations while their full PEP implementations remain separate. This starts the migration and does not claim complete 3.15 bytecode or runtime compatibility.

Assisted-by: Codex:model-version-unavailable
Import pinned rc2 test_import and its fixtures, preserving RustPython markers. The upstream tests remove obsolete module.__cached__ expectations. Match create_builtin validation for missing, non-string, empty, non-ASCII and unknown module names; unknown names must not succeed just because an unrelated module is cached. Add a CPython differential regression.

Assisted-by: Codex:model-version-unavailable
Use the PyStr reference directly after validating the ASCII name, fixing the compile error from the previous PyUtf8Str-only accessor.

Assisted-by: Codex:model-version-unavailable
Make the remaining compatibility work explicit in the project overview rather than implying that the initial target change completes support.

Assisted-by: Codex:model-version-unavailable
Import venv, its script assets and matching tests from CPython 435c9e5a798c99653e3ab64ce29baed0e4f3dfee. Preserve existing RustPython expected-failure markers and unchanged PowerShell line endings. Native comparison of unmodified rc2 tests reproduces the four known layout/zip-path differences plus the sandbox AF_UNIX limitation; offline pip bootstrap passes.

Assisted-by: Codex:model-version-unavailable
Add dictionary-owned frozen mapping storage, shared views and cached hashing, read-only execution globals, type namespace support, and stable dictionary C-API coverage. Add differential regressions against CPython 3.15rc2.

Assisted-by: Codex:model-version-unavailable
Remove the temporary MappingProxyType alias now that PEP 814 is integrated into this branch.

Assisted-by: Codex:model-version-unavailable
Sync enum and its regression tests from CPython v3.15.0rc2 (435c9e5a798c99653e3ab64ce29baed0e4f3dfee). Preserve the two existing RustPython expected-failure decorators. Keep this first migration slice limited to enum without changing the declared Python target or native runtime.

AI assistance: Codex/OpenAI reconstructed the upstream sync, reviewed the diff, and ran validation. The runtime did not expose the exact model version.

Assisted-by: Codex:model-version-unavailable
Resolve real symlink identity before generic home/python, retain explicit base-executable metadata for copied environments, and bound legacy creator traversal. This prevents copied aliases from producing dangling nested interpreters or silently selecting an unrelated CPython executable. The POSIX regression covers all copy/symlink combinations and deletion of the creator environment.

Assisted-by: Codex:model-version-unavailable
Consolidate the staged native prerequisites and pinned library sources into one migration branch. Preserve RustPython adaptations and transferred test markers. This is a local integration checkpoint before cold combined verification; feature and platform gaps remain recorded in the migration evidence.

Assisted-by: Codex:model-version-unavailable
Assisted-by: Codex:model-version-unavailable
youknowone pushed a commit that referenced this pull request Oct 10, 2026
* Use current locale for byte regular-expression matching

Extract the Python 3.14-compatible LOCALE matching paths from #8954, keeping host callbacks outside the no_std engine and preserving the C-locale fallback. Existing canonical regex tests cover locale changes and compiled patterns. Keep expected-failure markers until patched native execution proves they are obsolete; omit duplicate snippet tests and Python 3.15 prefixmatch additions.

Assisted-by: OpenAI Codex:model identifier unavailable

* Enable the repaired locale caching regression

The exact patched native interpreter passes the existing locale flag and compiled-pattern tests and unexpectedly passes locale caching. Remove only the obsolete expected-failure decorator; preserve all canonical assertions and platform skips.

Assisted-by: OpenAI Codex:model identifier unavailable
youknowone pushed a commit that referenced this pull request Oct 10, 2026
Extract the Python 3.14-compatible timeout validation order from #8954. Share validation with Lock and run it before increasing the RLock recursion count. Keep canonical general-lock coverage and add only owned-lock validation regressions to the existing thread snippet.

Assisted-by: OpenAI Codex:model identifier unavailable
youknowone pushed a commit that referenced this pull request Oct 10, 2026
Extract the Python 3.14-compatible signed timestamp conversion from #8954, preserving floor rounding, float-or-index argument rules and signed divmod remainders. Reuse the existing Windows file-time helper rather than the mega patch range restriction, and keep the 3.14 argument diagnostics. Add three concise parser regressions to the existing os snippet without native filesystem range assumptions.

Assisted-by: OpenAI Codex:model identifier unavailable
youknowone pushed a commit that referenced this pull request Oct 10, 2026
* Preserve reflected addition for native sequence subclasses

Extract the Python 3.14-compatible sequence-add slot distinction from #8954 without its unconditional numeric-slot clearing. Preserve stateful duplicate-slot behavior, exact descriptor identity, inherited reflected priority and a stable wrapper function address. Extend the existing addition snippet only for the uncovered inherited-native and slot-update cases.

Assisted-by: OpenAI Codex:model identifier unavailable

* Use stored MRO for sequence descriptor ownership

Assisted-by: OpenAI Codex:model identifier unavailable
youknowone pushed a commit that referenced this pull request Oct 10, 2026
Extract the Python 3.14-compatible descriptor slot dispatch from #8954. Call the raw type attribute with descriptor, instance and owner, preserving ownership and recursion handling. Extend the existing Python snippet for staticmethod, classmethod, callable-object and ordinary __get__ replacements.

Assisted-by: OpenAI Codex:model identifier unavailable
youknowone pushed a commit that referenced this pull request Oct 10, 2026
Extract the startup import_site guard from #8954. Preserve existing logging and comments, and cover the missing sys.modules behavior under -S in the existing sys snippet.

Assisted-by: OpenAI Codex:model identifier unavailable
youknowone pushed a commit that referenced this pull request Oct 10, 2026
* Track live entries in reverse dictionary iterators

Extract the Python 3.14-compatible remaining-count and same-size storage handling from #8954. Preserve the older deferred exhaustion and extra-yield contract, using explicit wrapping arithmetic rather than the Python 3.15 extra-yield error and cursor clamp. Cover deleted-slot hints and mutation after the last yield in the existing Python snippet.

Assisted-by: OpenAI Codex:model identifier unavailable

* Enable the repaired reverse-dict restoration regression

The patched native interpreter unexpectedly passes the existing reverse-dict clear/restore test. Remove only its obsolete expected-failure decorator, preserving the canonical assertions and all other markers.

Assisted-by: OpenAI Codex:model identifier unavailable

* Preserve reverse iterator invalidation on atomic relocation

Assisted-by: OpenAI Codex:model identifier unavailable
youknowdot added a commit to youknowdot/RustPython that referenced this pull request Oct 11, 2026
Extract the Python 3.14-compatible blob integer-index conversion from RustPython#8954. Preserve original index types in overflow diagnostics, use IndexError rather than C-int conversion overflow, and retain exceptions raised by __index__. Extend the existing SQLite snippet with bounded in-memory read/write cases; no callback or lifetime changes.

Assisted-by: OpenAI Codex:model identifier unavailable
youknowdot added a commit to youknowdot/RustPython that referenced this pull request Oct 11, 2026
Extract the Python 3.14-compatible blob integer-index conversion from RustPython#8954. Preserve original index types in overflow diagnostics, use IndexError rather than C-int conversion overflow, and retain exceptions raised by __index__. Extend the existing SQLite snippet with bounded in-memory read/write cases; no callback or lifetime changes.

Assisted-by: OpenAI Codex:model identifier unavailable
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