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

Method cmp

crates/vm/src/builtins/genericalias.rs:606–627  ·  view source on GitHub ↗
(
        zelf: &Py<Self>,
        other: &PyObject,
        op: PyComparisonOp,
        vm: &VirtualMachine,
    )

Source from the content-addressed store, hash-verified

604
605impl Comparable for PyGenericAlias {
606 fn cmp(
607 zelf: &Py<Self>,
608 other: &PyObject,
609 op: PyComparisonOp,
610 vm: &VirtualMachine,
611 ) -> PyResult<PyComparisonValue> {
612 op.eq_only(|| {
613 let other = class_or_notimplemented!(Self, other);
614 if zelf.starred != other.starred {
615 return Ok(PyComparisonValue::Implemented(false));
616 }
617 Ok(PyComparisonValue::Implemented(
618 zelf.__origin__()
619 .rich_compare_bool(&other.__origin__(), PyComparisonOp::Eq, vm)?
620 && zelf.__args__().rich_compare_bool(
621 &other.__args__(),
622 PyComparisonOp::Eq,
623 vm,
624 )?,
625 ))
626 })
627 }
628}
629
630impl Hashable for PyGenericAlias {

Callers

nothing calls this directly

Calls 4

eq_onlyMethod · 0.80
rich_compare_boolMethod · 0.80
__origin__Method · 0.45
__args__Method · 0.45

Tested by

no test coverage detected