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

Function special_method_can_suggest

crates/vm/src/frame.rs:9625–9646  ·  view source on GitHub ↗

_PyEval_SpecialMethodCanSuggest

(
    obj: &PyObjectRef,
    oparg: SpecialMethod,
    vm: &VirtualMachine,
)

Source from the content-addressed store, hash-verified

9623
9624/// _PyEval_SpecialMethodCanSuggest
9625fn special_method_can_suggest(
9626 obj: &PyObjectRef,
9627 oparg: SpecialMethod,
9628 vm: &VirtualMachine,
9629) -> PyResult<bool> {
9630 Ok(match oparg {
9631 SpecialMethod::Enter | SpecialMethod::Exit => {
9632 vm.get_special_method(obj, get_special_method_name(SpecialMethod::AEnter, vm))?
9633 .is_some()
9634 && vm
9635 .get_special_method(obj, get_special_method_name(SpecialMethod::AExit, vm))?
9636 .is_some()
9637 }
9638 SpecialMethod::AEnter | SpecialMethod::AExit => {
9639 vm.get_special_method(obj, get_special_method_name(SpecialMethod::Enter, vm))?
9640 .is_some()
9641 && vm
9642 .get_special_method(obj, get_special_method_name(SpecialMethod::Exit, vm))?
9643 .is_some()
9644 }
9645 })
9646}
9647
9648fn get_special_method_name(oparg: SpecialMethod, vm: &VirtualMachine) -> &'static PyStrInterned {
9649 match oparg {

Callers 1

execute_instructionMethod · 0.85

Calls 2

get_special_method_nameFunction · 0.85
get_special_methodMethod · 0.80

Tested by

no test coverage detected