You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit b99f38d
Browse filesBrowse the repository at this point in the historyBrowse files
Bind interpreter arguments with borrowed Clinic structs (#9763)
* Bind interpreter arguments with borrowed Clinic structs
Extend the existing FromArgs derive with borrowed binding. Retain the native call input owners, validate and bind slots once before conversion, and generate signatures from the same fields. Remove the interpreter ArgSpec parsers and preserve conversion and finalization order without keepalive clones or allocation.
Cover binding precedence, raw and inspected signatures, temporary lifetimes, reference counts, generated code, and borrowed payload validation.
Assisted-by: OpenAI Codex:model version not exposed
* Return infallible interpreter query results directly
Assisted-by: OpenAI Codex:model version not exposed
* Match tuple reference-counted destruction order
Release references extracted from tuples in reverse order, including nested
and subclassed tuples. Select the order through a payload constant so other
payloads keep their existing deallocation path and no new allocation is needed.
Assisted-by: OpenAI Codex:model version not exposed
* Retain expanded call argument owners through dispatch
Keep the original keyword dictionary and positional tuple alive through
non-Python and instrumented CALL_FUNCTION_EX invocations. Preserve the early
container release for ordinary exact Python functions. Release keyword owners
before positional owners, including exceptions and monitoring callbacks.
Normalize tuple subclasses through iteration. A general iterable's normalized
values retain their own storage for calls that need it, without allocating an
otherwise unobservable tuple object. Cover exact functions, methods, callable
objects, native calls, conversion failures, and monitoring transitions.
Assisted-by: OpenAI Codex:model version not exposed
* Release borrowed native arguments in stack order
Release keyword and then positional owners in reverse evaluation order after
binding, conversion, execution, and return conversion, including errors. The
borrowed argument abstraction needs no additional allocation or reference clone.
Expanded calls retain their original container ownership at the call boundary.
Match CPython temporary lifetimes for reordered, mixed, expanded, successful,
and failing interpreter calls instead of preserving the former keyword-order
difference.
Assisted-by: OpenAI Codex:model version not exposed
* Avoid call ownership helper overhead
Combine expanded-argument collection with dispatch so original owners stay
local instead of crossing two helper boundaries in a large aggregate. Select
instrumentation at compile time and reserve keyword space when copying the
positional values, avoiding a subsequent vector reallocation.
Inline borrowed-owner cleanup into native wrappers so it does not introduce
an additional call and owned FuncArgs transfer on every native invocation.
Assisted-by: OpenAI Codex:model version not exposed
* Parse from_args modes in one place
Parse `borrowed`, `legacy`, and `fname` through a single FromArgsMode so
`#[from_args(borrowed, legacy)]` is rejected and the unknown-key error lists
`borrowed`. Bind `_interpreters.list_all` with an owned struct instead of a
borrowed struct carrying only a PhantomData lifetime. Reword two comments.
Assisted-by: Claude:claude-opus-5-5
Assisted-by: Grok:grok-4.7
---------
Co-authored-by: Jeong, YunWon <jeong@youknowone.org>
Copy file name to clipboardExpand all lines: crates/derive/src/lib.rs
+29Lines changed: 29 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -85,6 +85,35 @@ use syn::punctuated::Punctuated;
85
85
/// | `Option<T>` | `None` or a value. A missing argument and an explicit `None` are the same | `= None` | `None` |
86
86
/// | `OptionalOption<T>` (`OptionalArg<Option<T>>`) | missing, `None`, and a value are all distinct | `= NULL`, and `None` is accepted | `<unrepresentable>` |
87
87
///
88
+
/// # Borrowed arguments
89
+
/// `#[from_args(borrowed)]` selects borrowing with the same strict Clinic rules:
0 commit comments