(&self, vm: &VirtualMachine)
| 499 | } |
| 500 | |
| 501 | fn make_cancelled_error_impl(&self, vm: &VirtualMachine) -> PyBaseExceptionRef { |
| 502 | // If a saved CancelledError exists, take it (clearing the stored reference) |
| 503 | if let Some(exc) = self.fut_cancelled_exc.write().take() |
| 504 | && let Ok(exc) = exc.downcast::<PyBaseException>() |
| 505 | { |
| 506 | return exc; |
| 507 | } |
| 508 | |
| 509 | let msg = self.fut_cancel_msg.read().clone(); |
| 510 | let args = if let Some(m) = msg { vec![m] } else { vec![] }; |
| 511 | |
| 512 | match get_cancelled_error_type(vm) { |
| 513 | Ok(cancelled_error) => vm.new_exception(cancelled_error, args), |
| 514 | Err(_) => vm.new_runtime_error("cancelled"), |
| 515 | } |
| 516 | } |
| 517 | |
| 518 | fn schedule_callbacks(zelf: &PyRef<Self>, vm: &VirtualMachine) -> PyResult<()> { |
| 519 | // Collect all callbacks first to avoid holding locks during callback execution |
no test coverage detected