(
tool_id: i32,
code: PyObjectRef,
event_set: i32,
vm: &VirtualMachine,
)
| 649 | } |
| 650 | |
| 651 | fn 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 | |
| 674 | fn restart_events(vm: &VirtualMachine) { |
| 675 | let mut state = vm.state.monitoring.lock(); |
nothing calls this directly
no test coverage detected