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

Method func_callback

crates/stdlib/src/_sqlite3.rs:447–472  ·  view source on GitHub ↗
(
            context: *mut sqlite3_context,
            argc: c_int,
            argv: *mut *mut sqlite3_value,
        )

Source from the content-addressed store, hash-verified

445 }
446
447 unsafe extern "C" fn func_callback(
448 context: *mut sqlite3_context,
449 argc: c_int,
450 argv: *mut *mut sqlite3_value,
451 ) {
452 let context = SqliteContext::from(context);
453 let (func, vm) = unsafe { (*context.user_data::<Self>()).retrieve() };
454 let args = unsafe { core::slice::from_raw_parts(argv, argc as usize) };
455
456 let f = || -> PyResult<()> {
457 let db = context.db_handle();
458 let args = args
459 .iter()
460 .cloned()
461 .map(|val| value_to_object(val, db, vm))
462 .collect::<PyResult<Vec<PyObjectRef>>>()?;
463
464 let val = func.call(args, vm)?;
465
466 context.result_from_object(&val, vm)
467 };
468
469 if let Err(exc) = f() {
470 context.result_exception(vm, exc, "user-defined function raised exception\0")
471 }
472 }
473
474 unsafe extern "C" fn step_callback(
475 context: *mut sqlite3_context,

Callers

nothing calls this directly

Calls 9

value_to_objectFunction · 0.85
retrieveMethod · 0.80
db_handleMethod · 0.80
result_from_objectMethod · 0.80
result_exceptionMethod · 0.80
fFunction · 0.50
mapMethod · 0.45
iterMethod · 0.45
callMethod · 0.45

Tested by

no test coverage detected