Skip to content

Restore ten guarded C API test modules with explicit updater import bindings - #9505

Draft
youknowdot wants to merge 1 commit into
RustPython:mainfrom
youknowdot:upgrade/capi-fixture-sources-20261031
Draft

youknowdot wants to merge 1 commit into
RustPython:mainfrom
youknowdot:upgrade/capi-fixture-sources-20261031

Conversation

@youknowdot

Copy link
Copy Markdown
Contributor

Summary

Restore ten whole test_capi modules from pinned CPython 3.15 (d220409a13b77de7a6c30abe16ea90db01528edc) through the actual scripts/update_lib migrate command:

  • Canonical byte-identical: test_file, test_object, test_run, test_set, test_slots, test_tuple, test_complex, test_float.
  • test_codecs: use the existing optional import helper for _testcapi before the unchanged _testlimitedcapi gate.
  • test_getargs: bind the genuinely required getargs_keywords and getargs_keyword_only through existing support.get_attribute. A partial fixture such as Add a _testcapi module #9143 lacks these APIs; this raises a real capability skip rather than an import failure. The unchanged complex/float sibling imports propagate that skip.

All class/function bodies, decorators and assertions remain canonical. No new skip decorators, xfails, fake fixtures or global test-disable switches are introduced. This is source restoration, not implementation of these C API fixtures. The package still has 22 missing canonical files afterward.

Generic updater extension

Add explicitly declared import_binding_rewrites to the already landed new-file adaptation mechanism. Only exact, same-name import-to-canonical-helper bindings are admitted, with module/name/alias/order/provenance and scope-shadow checks. Validated groups retain their position among protected statements. Existing default migrations, source-hash/path/block/overlap/overwrite protections and class/function AST checks remain unchanged. Relative/dotted/star imports and unsupported rewrite forms fail closed.

#9498 and #9501 have landed. This diff contains only the new tooling extension and ten module additions; no duplicated parent code or synthetic dependency commit.

Validation

  • Reproduced on main 88f373357f40923c7b1bb533072e7962790e2663; all 17 original parent-file bytes were checked against their PR heads.
  • Host updater suite: 241 tests passed, independently rechecked with Python 3.13 and 3.12.
  • Actual candidate updater generated all ten modules. Eight canonical byte identities, two exact reviewed metadata adaptations, and full class/function/decorator/assertion AST equality were verified.
  • Normal configured commit hooks passed; final 13-file hashes and reviewed diff were unchanged afterward.
  • Following an execution-environment reset, the private reviewed patch and metadata were recovered byte-for-byte from preserved artifacts. The newly generated files exactly match the historical Python 3.15 migration output hashes. Current selected-source parsing/tooling checks used Python 3.13; no fresh Python 3.15 runtime or full dependency-graph validation is claimed.

Limits and future activation

No C API test module was imported or executed locally, and no Rust/native build or full interpreter suite was run for this source-only cohort. Missing-fixture skips in ordinary builds are not C API behavioral passes or complete CPython compatibility.

If a future _testcapi provides both getargs entry points, re-review the subsequent constants, eager class-body getargs_positional_only_and_keywords import and remaining parser APIs before activation. Introducing _testlimitedcapi similarly requires separate review of NULL/invalid arguments, refcounts, mutation, GC/finalizer and subprocess paths. Existing bodies are preserved, not claimed safe or supported by module presence alone.

AI assistance

OpenAI Codex assisted source investigation, updater implementation, migration, recovery and validation, with independent agent review. The runtime model version is unavailable. This reports tool/source evidence, not human manual validation or unexecuted native compatibility checks.

Restore ten CPython 3.15 test modules through the actual update_lib migrator. Eight are canonical copies; codecs/getargs use declared exact optional-module and required-attribute bindings while all class/function/decorator/assertion ASTs remain unchanged. Extend the landed generic updater with an explicit import-binding rewrite option, preserving default validation and hash/path/block/protected-AST guards.

Reproduced on main 88f3733 after both prerequisite PRs landed. The recovered reviewed tooling delta is applied before migration; no synthetic dependency commit is included. Current host tooling suite passes 241 tests with Python 3.13, selected AST/source proof and normal hooks pass, and all output bytes match preserved historical Python 3.15 migration hashes. This is not a fresh Python 3.15 runtime or dependency-graph validation. No C API test modules or native fixtures were executed; unsupported fixture skips are not complete C API compatibility.

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

coderabbitai Bot commented Oct 31, 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

@github-actions

github-actions Bot commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

📦 Library Dependencies

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

[ ] test: cpython/Lib/test/test_capi (TODO: 2)

dependencies:

dependent tests: (no tests depend on capi)

Legend:

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

@youknowone

Copy link
Copy Markdown
Member

do not add this before #9270

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.

3 participants