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

Method make_cancelled_error_impl

crates/stdlib/src/_asyncio.rs:501–516  ·  view source on GitHub ↗
(&self, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

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

Callers 5

resultMethod · 0.80
exceptionMethod · 0.80
_make_cancelled_errorMethod · 0.80
task_step_implFunction · 0.80

Calls 6

get_cancelled_error_typeFunction · 0.85
new_exceptionMethod · 0.80
takeMethod · 0.45
writeMethod · 0.45
cloneMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected