(zelf: PyRef<Self>, args: CancelArgs, vm: &VirtualMachine)
| 460 | |
| 461 | #[pymethod] |
| 462 | fn cancel(zelf: PyRef<Self>, args: CancelArgs, vm: &VirtualMachine) -> PyResult<bool> { |
| 463 | if zelf.fut_loop.read().is_none() { |
| 464 | return Err(vm.new_runtime_error("Future object is not initialized.")); |
| 465 | } |
| 466 | if zelf.fut_state.load() != FutureState::Pending { |
| 467 | // Clear log_tb even when cancel fails |
| 468 | zelf.fut_log_tb.store(false, Ordering::Relaxed); |
| 469 | return Ok(false); |
| 470 | } |
| 471 | |
| 472 | *zelf.fut_cancel_msg.write() = args.msg.flatten(); |
| 473 | zelf.fut_state.store(FutureState::Cancelled); |
| 474 | Self::schedule_callbacks(&zelf, vm)?; |
| 475 | Ok(true) |
| 476 | } |
| 477 | |
| 478 | #[pymethod] |
| 479 | fn cancelled(&self) -> bool { |
nothing calls this directly
no test coverage detected