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

Method invoke_exception

crates/vm/src/exceptions.rs:352–366  ·  view source on GitHub ↗
(
        &self,
        cls: PyTypeRef,
        args: Vec<PyObjectRef>,
    )

Source from the content-addressed store, hash-verified

350 }
351
352 pub fn invoke_exception(
353 &self,
354 cls: PyTypeRef,
355 args: Vec<PyObjectRef>,
356 ) -> PyResult<PyBaseExceptionRef> {
357 // TODO: fast-path built-in exceptions by directly instantiating them? Is that really worth it?
358 let res = PyType::call(&cls, args.into_args(self), self)?;
359 res.downcast::<PyBaseException>().map_err(|obj| {
360 self.new_type_error(format!(
361 "calling {} should have returned an instance of BaseException, not {}",
362 cls,
363 obj.class()
364 ))
365 })
366 }
367}
368
369fn print_source_line<W: Write>(

Callers 8

instantiateMethod · 0.80
instantiate_valueMethod · 0.80
slot_newMethod · 0.80
deriveMethod · 0.80
exitFunction · 0.80
flushMethod · 0.80
writeMethod · 0.80
check_hresultFunction · 0.80

Calls 2

callFunction · 0.50
into_argsMethod · 0.45

Tested by

no test coverage detected