(ctx: &crate::vm::Context, class: &'static Py<crate::builtins::PyType>)
| 2795 | |
| 2796 | #[extend_class] |
| 2797 | fn extend_pyclass(ctx: &crate::vm::Context, class: &'static Py<crate::builtins::PyType>) { |
| 2798 | // Override __reduce__ to return (type, (sched_priority,)) |
| 2799 | // instead of the generic structseq (type, ((sched_priority,),)). |
| 2800 | // The trait's extend_class checks contains_key before setting default. |
| 2801 | const SCHED_PARAM_REDUCE: crate::function::PyMethodDef = |
| 2802 | crate::function::PyMethodDef::new_const( |
| 2803 | "__reduce__", |
| 2804 | |zelf: crate::PyRef<crate::builtins::PyTuple>, |
| 2805 | vm: &VirtualMachine| |
| 2806 | -> PyTupleRef { |
| 2807 | vm.new_tuple((zelf.class().to_owned(), (zelf[0].clone(),))) |
| 2808 | }, |
| 2809 | crate::function::PyMethodFlags::METHOD, |
| 2810 | None, |
| 2811 | ); |
| 2812 | class.set_attr( |
| 2813 | ctx.intern_str("__reduce__"), |
| 2814 | SCHED_PARAM_REDUCE.to_proper_method(class, ctx), |
| 2815 | ); |
| 2816 | } |
| 2817 | } |
| 2818 | |
| 2819 | #[cfg(not(target_env = "musl"))] |
nothing calls this directly
no test coverage detected