MCPcopy Index your code
hub / github.com/RustPython/RustPython / method_is_overloaded

Function method_is_overloaded

crates/vm/src/vm/vm_ops.rs:13–28  ·  view source on GitHub ↗

[CPython `method_is_overloaded`](https://github.com/python/cpython/blob/v3.14.3/Objects/typeobject.c#L9849-L9879)

(
    class_a: &Py<PyType>,
    class_b: &Py<PyType>,
    rop_name: Option<&'static PyStrInterned>,
    vm: &VirtualMachine,
)

Source from the content-addressed store, hash-verified

11
12/// [CPython `method_is_overloaded`](https://github.com/python/cpython/blob/v3.14.3/Objects/typeobject.c#L9849-L9879)
13fn method_is_overloaded(
14 class_a: &Py<PyType>,
15 class_b: &Py<PyType>,
16 rop_name: Option<&'static PyStrInterned>,
17 vm: &VirtualMachine,
18) -> PyResult<bool> {
19 let Some(rop_name) = rop_name else {
20 return Ok(false);
21 };
22 let Some(method_b) = class_b.get_attr(rop_name) else {
23 return Ok(false);
24 };
25 class_a.get_attr(rop_name).map_or(Ok(true), |method_a| {
26 vm.identical_or_equal(&method_a, &method_b).map(|eq| !eq)
27 })
28}
29
30macro_rules! binary_func {
31 ($fn:ident, $op_slot:ident, $op:expr) => {

Callers 2

binary_op1Method · 0.85
ternary_opMethod · 0.85

Calls 3

identical_or_equalMethod · 0.80
get_attrMethod · 0.45
mapMethod · 0.45

Tested by

no test coverage detected