(
&self,
cls: PyTypeRef,
args: Vec<PyObjectRef>,
)
| 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 | |
| 369 | fn print_source_line<W: Write>( |
no test coverage detected