Instantiate an exception with `msg` as the only argument and `dict` for object This function should only be used with builtin exception types; if a user-defined exception type is passed in, it may not be fully initialized; try using [`vm.invoke_exception()`][Self::invoke_exception] or [`exceptions::ExceptionCtor`][crate::exceptions::ExceptionCtor] instead.
(
&self,
exc_type: PyTypeRef,
msg: Wtf8Buf,
dict: PyDictRef,
)
| 161 | /// [`vm.invoke_exception()`][Self::invoke_exception] or |
| 162 | /// [`exceptions::ExceptionCtor`][crate::exceptions::ExceptionCtor] instead. |
| 163 | pub fn new_exception_msg_dict( |
| 164 | &self, |
| 165 | exc_type: PyTypeRef, |
| 166 | msg: Wtf8Buf, |
| 167 | dict: PyDictRef, |
| 168 | ) -> PyBaseExceptionRef { |
| 169 | PyRef::new_ref( |
| 170 | // TODO: this constructor might be invalid, because multiple |
| 171 | // exception (even builtin ones) are using custom constructors, |
| 172 | // see `OSError` as an example: |
| 173 | PyBaseException::new(vec![self.ctx.new_str(msg).into()], self), |
| 174 | exc_type, |
| 175 | Some(dict), |
| 176 | ) |
| 177 | } |
| 178 | |
| 179 | pub fn new_no_attribute_error(&self, obj: PyObjectRef, name: PyStrRef) -> PyBaseExceptionRef { |
| 180 | let msg = format!( |
no test coverage detected