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

Function set_local_events

crates/vm/src/stdlib/sys/monitoring.rs:651–672  ·  view source on GitHub ↗
(
    tool_id: i32,
    code: PyObjectRef,
    event_set: i32,
    vm: &VirtualMachine,
)

Source from the content-addressed store, hash-verified

649}
650
651fn set_local_events(
652 tool_id: i32,
653 code: PyObjectRef,
654 event_set: i32,
655 vm: &VirtualMachine,
656) -> PyResult<()> {
657 if code.downcast_ref::<PyCode>().is_none() {
658 return Err(vm.new_type_error("code must be a code object"));
659 }
660 let tool = check_valid_tool(tool_id, vm)?;
661 check_tool_in_use(tool, vm)?;
662 let normalized = normalize_event_set(event_set, true, vm)?;
663 let code_id = code.get_id();
664 let mut state = vm.state.monitoring.lock();
665 if normalized == 0 {
666 state.local_events.remove(&(tool, code_id));
667 } else {
668 state.local_events.insert((tool, code_id), normalized);
669 }
670 update_events_mask(vm, &state);
671 Ok(())
672}
673
674fn restart_events(vm: &VirtualMachine) {
675 let mut state = vm.state.monitoring.lock();

Callers

nothing calls this directly

Calls 10

check_valid_toolFunction · 0.85
check_tool_in_useFunction · 0.85
normalize_event_setFunction · 0.85
update_events_maskFunction · 0.85
ErrClass · 0.50
is_noneMethod · 0.45
get_idMethod · 0.45
lockMethod · 0.45
removeMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected