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

Function new_invalid_state_error

crates/stdlib/src/_asyncio.rs:2720–2733  ·  view source on GitHub ↗
(vm: &VirtualMachine, msg: &str)

Source from the content-addressed store, hash-verified

2718 }
2719
2720 fn new_invalid_state_error(vm: &VirtualMachine, msg: &str) -> PyBaseExceptionRef {
2721 match vm.import("asyncio.exceptions", 0) {
2722 Ok(module) => {
2723 match vm.get_attribute_opt(module, vm.ctx.intern_str("InvalidStateError")) {
2724 Ok(Some(exc_type)) => match exc_type.call((msg,), vm) {
2725 Ok(exc) => exc.downcast().unwrap(),
2726 Err(_) => vm.new_runtime_error(msg.to_string()),
2727 },
2728 _ => vm.new_runtime_error(msg.to_string()),
2729 }
2730 }
2731 Err(_) => vm.new_runtime_error(msg.to_string()),
2732 }
2733 }
2734
2735 fn get_copy_context(vm: &VirtualMachine) -> PyResult<PyObjectRef> {
2736 let contextvars = vm.import("contextvars", 0)?;

Callers 5

resultMethod · 0.85
exceptionMethod · 0.85
set_resultMethod · 0.85
set_exceptionMethod · 0.85
task_step_implFunction · 0.85

Calls 7

get_attribute_optMethod · 0.80
intern_strMethod · 0.80
downcastMethod · 0.80
to_stringMethod · 0.80
importMethod · 0.45
callMethod · 0.45
unwrapMethod · 0.45

Tested by

no test coverage detected