◐ Shell
clean mode source ↗

extend types and exceptions only for genesis by youknowone · Pull Request #7316 · RustPython/RustPython

Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@crates/vm/src/class.rs`:
- Around line 191-196: The unsafe cast to &'static PyMethodDef (using
ctx.slot_new_wrapper) is unsound because extend_class takes ctx: &Context;
change the trait signature to require static lifetimes (e.g., fn
extend_class(ctx: &'static Context, class: &'static Py<PyType>)) so the compiler
encodes the invariant, update all impls/call sites accordingly, then remove the
unsafe &'static cast and use wrapper = &ctx.slot_new_wrapper directly (or keep
wrapper as &'static if callers now supply &'static Context); reference symbols:
extend_class, Context, ctx.slot_new_wrapper, PyMethodDef, build_bound_method,
and class.set_attr to locate and modify the code.