mirror of
https://github.com/RustPython/RustPython.git
synced 2026-10-28 10:44:36 +08:00
* Report errors from #[pyclass] trait items The trait branch of impl_pyclass_impl built its own ImplContext, so the errors collected while extracting trait items were never emitted: an invalid #[pymethod] or #[pygetset] in a #[pyclass] trait was left out of the class without a compile error. The trait branch now uses the shared context whose errors are emitted. Assisted-by: Claude Code:claude-opus-5-5 * Pass the object to #[pymethod] and #[pygetset] receivers outside vm Outside crates/vm, where impl Py<T> cannot be written, #[pymethod] and #[pygetset] receivers that took &self become zelf: &Py<Self> inside the existing impl T blocks. Where Rust code calls one of these methods on a payload value, the logic stays in a payload method and the Python method forwards to it. Assisted-by: Claude Code:claude-opus-5-5 Assisted-by: Grok:grok-4.7 * Reject payload receivers on #[pymethod] and #[pygetset] A #[pymethod] or #[pygetset] item with a self receiver is now a compile error when self is the payload: in an impl for T rather than Py<T> or PyRef<T>, and in a #[pyclass] trait. The error points to taking zelf: &Py<Self> or zelf: PyRef<Self>, or defining the item in impl Py<T>. Assisted-by: Claude Code:claude-opus-5-5 * Pass the object to the layout test getter The subclass layout test's extra getter is a #[pygetset] on the payload. Take zelf: &Py<Self> so the receiver is the object. Assisted-by: Grok:4.7