Repository navigation
Align function construction and metadata controls - #9717
Conversation
|
Caution Review failedThe pull request is closed.
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. |
| } | ||
|
|
||
| #[pygetset(name = "__defaults__")] | ||
| fn get_defaults(&self, vm: &VirtualMachine) -> PyResult<Option<PyTupleRef>> { |
There was a problem hiding this comment.
keep pygetset function name as fn __defaults__ and rename the exising one to the other one
f5acfd3 to
83dbeaf
Compare
Preserve constructor binding, validation, audit veto and argument owners. Audit public metadata without changing internal reads, retaining live-field semantics and Unicode names. Assisted-by: OpenAI Codex:model version not exposed
Rename the unaudited Rust helpers instead of overriding Python getter names, following the exception add_note review. Update internal cross-interpreter callers without introducing audits. Assisted-by: Codex:model-version-unavailable
Assisted-by: OpenAI Codex:model version not exposed
Preserve callback ownership, release ordering, and retained argument owners. Assisted-by: Codex:model-version-unavailable
038adc0 to
f31c918
Compare
Remove the custom ArgSpec slot and redundant parsed-owner allocation. Retain raw argument owners because eager typed failures can run finalizers before later error formatting in direct __new__ calls. Assisted-by: OpenAI Codex:gpt-6.1-sol
Assisted-by: OpenAI Codex:gpt-6.1-sol
Both replaced values still drop after lock release and version invalidation, before returning the callback-free unit result. Assisted-by: OpenAI Codex:gpt-6.1-sol
Merging this PR will not alter performance
Comparing Footnotes
|
Keep the error-formatting lifetime regression, but do not impose CPython 3.12 finalizer ordering on CPython 3.15. Assisted-by: OpenAI Codex:gpt-6.1-sol
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Summary
Align function construction and public metadata controls with Python 3.15 with focused Python regression coverage.
No handwritten per-function argument parser, Lib, markers or workflow changes. A direct
function.__new__error-formatting lifetime regression is covered inextra_tests/snippets/syntax_function.py. Existing bound-method and annotation changes remain outside this patch.Validation
Compared with pinned CPython function controls and its generated Clinic signature. Independent source review passed, including owner lifetimes, audit timing/payloads, lock boundaries and unaudited internal callers.
Reference probes passed 71 metadata cases, four doc initialization cases, 1,024 positional/keyword layouts compared with the shared binder model, and 27 additional metadata/Unicode/hook cases. Constructed or modified code/functions were only inspected, never executed. These are CPython/source checks, not a RustPython runtime pass.
Limits and integration
Old code ownership remains deferred by the existing swap_to_temporary_refs mechanism. CPython releases old code constants earlier, but changing that here would undermine the outstanding-borrow safety design; no immediate-destruction parity is claimed. Shared unexpected-keyword surrogate formatting also remains unchanged. Function deallocation/GC redesign, JIT behavior and annotation reentrancy are outside scope.
Fresh relevant PR patches were checked and do not duplicate this group. Composing #9715 has one textual conflict in function.rs imports: retain this patch's PyDict/PyTypeRef imports and remove PyList once its custom method directory is removed. Independent read-only apply checks confirmed all other hunks apply after that import-only resolution. Combined branches were not compiled or executed. Preserve #9700 annotation diagnostics; that region is unchanged here. #6894 changes freevar representation, and #8624 has adjacent JIT invalidation work that requires preserving its logic if integrated. No combined runtime claim is made.
The latest local validation is recorded below. Separate cross-platform graphs still require hosted CI.
AI-assisted implementation and independent review using OpenAI Codex; model version is not exposed.
Clinic binding follow-up (2026-11-07)
slot_new, itsArgSpecslot vector, and duplicate argument-owner clones. The default Clinic binder handles the structural checks.function.__new__calls. A code constant finalizer can even rename the rejected globals type and change the error text. This is an ownership requirement, not a remaining Clinic binding mismatch. No new runtime guard or converter is introduced._oldbindings, preserving lock release, version invalidation, and finalizer order.Validation on the final local tree:
-D warningspassed.test_funcattrs: 36 tests, one skip, success.__new__error-owner and setter-finalizer reentry probes pass.CPython 3.15 CI correction
The first follow-up test incorrectly fixed the relative cleanup order observed on CPython 3.12. Actual CPython 3.15 CI finalizes those temporary arguments in the opposite order. Commit
4623020bc8removes that unsupported ordering assertion; it retains the regression requiring the globals TypeError to be formatted before a code-constant finalizer can rename the rejected type. CPython 3.15func_newand_PyArg_BadArgumentsource independently confirm this remaining requirement. Production Rust code is unchanged from311f2e81b7, so its workspace/C-API/Clippy validation still applies. The corrected exact snippet passes locally on RustPython and system CPython, and the native snippet suite again has the same 242 passes and six baseline environment failures. New hosted CI supplies the actual CPython 3.15 check.Actual CPython 3.15 CI verification for
4623020bc864ae2ca9c8b99cbe76de69e35d5b69: the fullrun snippetsstep passed on Ubuntu, macOS, and Windows. This resolves the three reported snippet failures. Other CI stages were still running at verification time; this is not a claim that the whole workflow is green. Compatibility conclusions use CPython 3.15 source and these actual 3.15 runs, not the older local interpreter.