(vm: &VirtualMachine, msg: &str)
| 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)?; |
no test coverage detected