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

Method call_method_with_args

crates/stdlib/src/_sqlite3.rs:646–678  ·  view source on GitHub ↗
(
            context: SqliteContext,
            instance: &PyObject,
            name: &str,
            args: &[*mut sqlite3_value],
            vm: &VirtualMachine,
        )

Source from the content-addressed store, hash-verified

644 }
645
646 fn call_method_with_args(
647 context: SqliteContext,
648 instance: &PyObject,
649 name: &str,
650 args: &[*mut sqlite3_value],
651 vm: &VirtualMachine,
652 ) {
653 let f = || -> PyResult<()> {
654 let db = context.db_handle();
655 let args = args
656 .iter()
657 .cloned()
658 .map(|val| value_to_object(val, db, vm))
659 .collect::<PyResult<Vec<PyObjectRef>>>()?;
660 vm.call_method(instance, name, args).map(drop)
661 };
662
663 if let Err(exc) = f() {
664 if exc.fast_isinstance(vm.ctx.exceptions.attribute_error) {
665 context.result_exception(
666 vm,
667 exc,
668 &format!("user-defined aggregate's '{name}' method not defined\0"),
669 )
670 } else {
671 context.result_exception(
672 vm,
673 exc,
674 &format!("user-defined aggregate's '{name}' method raised error\0"),
675 )
676 }
677 }
678 }
679 }
680
681 impl Drop for CallbackData {

Callers

nothing calls this directly

Calls 8

value_to_objectFunction · 0.85
db_handleMethod · 0.80
fast_isinstanceMethod · 0.80
result_exceptionMethod · 0.80
fFunction · 0.50
mapMethod · 0.45
iterMethod · 0.45
call_methodMethod · 0.45

Tested by

no test coverage detected