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

Method exception

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

Source from the content-addressed store, hash-verified

245
246 #[pymethod]
247 fn exception(&self, vm: &VirtualMachine) -> PyResult {
248 match self.fut_state.load() {
249 FutureState::Pending => Err(new_invalid_state_error(vm, "Exception is not set.")),
250 FutureState::Cancelled => {
251 let exc = self.make_cancelled_error_impl(vm);
252 Err(exc)
253 }
254 FutureState::Finished => {
255 self.fut_log_tb.store(false, Ordering::Relaxed);
256 Ok(self
257 .fut_exception
258 .read()
259 .clone()
260 .unwrap_or_else(|| vm.ctx.none()))
261 }
262 }
263 }
264
265 #[pymethod]
266 fn set_result(zelf: PyRef<Self>, result: PyObjectRef, vm: &VirtualMachine) -> PyResult<()> {

Callers

nothing calls this directly

Calls 8

new_invalid_state_errorFunction · 0.85
noneMethod · 0.80
ErrClass · 0.50
loadMethod · 0.45
storeMethod · 0.45
cloneMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected