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

Method set_authorizer

crates/stdlib/src/_sqlite3.rs:1378–1395  ·  view source on GitHub ↗
(&self, callable: PyObjectRef, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

1376
1377 #[pymethod]
1378 fn set_authorizer(&self, callable: PyObjectRef, vm: &VirtualMachine) -> PyResult<()> {
1379 let db = self.db_lock(vm)?;
1380 let Some(data) = CallbackData::new(callable, vm) else {
1381 unsafe { sqlite3_set_authorizer(db.db, None, null_mut()) };
1382 return Ok(());
1383 };
1384
1385 let ret = unsafe {
1386 sqlite3_set_authorizer(
1387 db.db,
1388 Some(CallbackData::authorizer_callback),
1389 Box::into_raw(Box::new(data)).cast(),
1390 )
1391 };
1392 db.check(ret, vm).map_err(|_| {
1393 new_operational_error(vm, "Error setting authorizer callback".to_owned())
1394 })
1395 }
1396
1397 #[pymethod]
1398 fn set_trace_callback(&self, callable: PyObjectRef, vm: &VirtualMachine) -> PyResult<()> {

Callers 4

setUpMethod · 0.80
test_clear_authorizerMethod · 0.80

Calls 6

newFunction · 0.85
db_lockMethod · 0.80
SomeClass · 0.50
castMethod · 0.45
checkMethod · 0.45
to_ownedMethod · 0.45

Tested by 4

setUpMethod · 0.64
test_clear_authorizerMethod · 0.64