Title: Align function construction and metadata controls by youknowdot · Pull Request #9717 · RustPython/RustPython · GitHub
Open Graph Title: Align function construction and metadata controls by youknowdot · Pull Request #9717 · RustPython/RustPython
X Title: Align function construction and metadata controls by youknowdot · Pull Request #9717 · RustPython/RustPython
Description: Summary Align function construction and public metadata controls with Python 3.15 with focused Python regression coverage. Use the default Clinic-compatible FromArgs binder before validating supplied objects. Accept code/globals keywords, retain raw argument owners, and match closure/default/kwdefault validation order and constructor audit veto. Emit public code/default/kwdefault read and mutation audits with the correct payloads and None-as-delete behavior. Read live fields after hooks and propagate vetoes before changes. Keep internal defaults accessors unaudited and release all locks before hooks or finalizers. Match code/name/type-parameter setter diagnostics, using the live function name after audit. Preserve lone-surrogate names in function repr and closure-count errors without invoking string-subclass formatting callbacks. Initialize doc only from a string first constant when the code declares a docstring. Preserve existing metadata identity, version invalidation and release-outside-lock behavior. No handwritten per-function argument parser, Lib, markers or workflow changes. A direct function.__new__ error-formatting lifetime regression is covered in extra_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) Remove the custom slot_new, its ArgSpec slot vector, and duplicate argument-owner clones. The default Clinic binder handles the structural checks. Keep raw argument owners intentionally. Eager typed conversion can run earlier arguments' finalizers before a later argument error is formatted in direct 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. Replace the two remaining redundant setter tail drops with scoped _old bindings, preserving lock release, version invalidation, and finalizer order. Validation on the final local tree: Normal repository commit hooks passed. Full workspace tests (documented exclusions), C-API tests, and workspace/C-API all-targets Clippy with -D warnings passed. Release test_funcattrs: 36 tests, one skip, success. 1,268 constructor layout/value/ownership probes match the previous PR head; direct-__new__ error-owner and setter-finalizer reentry probes pass. Native snippet suite: 242 passed, six failed. The same six fail on the previous PR head (multiprocessing condition/fork-sharer/sharedctypes, os, socket, sqlite; sandbox/optional-module constraints). The remaining error-formatting lifetime regression passes. CPython 3.15 source was inspected; the retained ownership probe also passes on the available system CPython 3.12. No CPython 3.15 local runtime claim. Hosted CI for the new commit is checked separately. 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 4623020bc8 removes 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.15 func_new and _PyArg_BadArgument source independently confirm this remaining requirement. Production Rust code is unchanged from 311f2e81b7, 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 full run snippets step 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.
Open Graph Description: Summary Align function construction and public metadata controls with Python 3.15 with focused Python regression coverage. Use the default Clinic-compatible FromArgs binder before validating suppl...
X Description: Summary Align function construction and public metadata controls with Python 3.15 with focused Python regression coverage. Use the default Clinic-compatible FromArgs binder before validating suppl...
Opengraph URL: https://github.com/RustPython/RustPython/pull/9717
X: @github
Domain: github.com
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:a68afcb4-a94e-a43d-7b58-f2eb0d249102 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | C6F8:1EFF:96E854:C8E2B9:6B01FE37 |
| html-safe-nonce | 7354d7ab7c43f724314b36d6d50925eeb58a733e3a79a2c83684b5b48ff3a7d0 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDNkY4OjFFRkY6OTZFODU0OkM4RTJCOTo2QjAxRkUzNyIsInZpc2l0b3JfaWQiOiI0MjU3MzA5NDg0MTA1NDY1Mzk5IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 14024d71f1d2195c482c90bf11494e318af4c7b03aa799902bbbbaddc60a979c |
| hovercard-subject-tag | pull_request:5160211590 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/RustPython/RustPython/pull/9717/files |
| twitter:image | https://avatars.githubusercontent.com/u/336763669?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/336763669?s=400&v=4 |
| og:image:alt | Summary Align function construction and public metadata controls with Python 3.15 with focused Python regression coverage. Use the default Clinic-compatible FromArgs binder before validating suppl... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/RustPython/RustPython git https://github.com/RustPython/RustPython.git |
| octolytics-dimension-user_id | 39710557 |
| octolytics-dimension-user_login | RustPython |
| octolytics-dimension-repository_id | 135201145 |
| octolytics-dimension-repository_nwo | RustPython/RustPython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 135201145 |
| octolytics-dimension-repository_network_root_nwo | RustPython/RustPython |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 423dbb54c5e7bfecc838eb387c1435eb3d0e760d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width