(
&self,
encoding: PyStrRef,
object: PyStrRef,
start: usize,
end: usize,
reason: PyStrRef,
)
| 291 | } |
| 292 | |
| 293 | pub fn new_unicode_encode_error_real( |
| 294 | &self, |
| 295 | encoding: PyStrRef, |
| 296 | object: PyStrRef, |
| 297 | start: usize, |
| 298 | end: usize, |
| 299 | reason: PyStrRef, |
| 300 | ) -> PyBaseExceptionRef { |
| 301 | let start = self.ctx.new_int(start); |
| 302 | let end = self.ctx.new_int(end); |
| 303 | let exc = self.new_exception( |
| 304 | self.ctx.exceptions.unicode_encode_error.to_owned(), |
| 305 | vec![ |
| 306 | encoding.clone().into(), |
| 307 | object.clone().into(), |
| 308 | start.clone().into(), |
| 309 | end.clone().into(), |
| 310 | reason.clone().into(), |
| 311 | ], |
| 312 | ); |
| 313 | exc.as_object() |
| 314 | .set_attr("encoding", encoding, self) |
| 315 | .unwrap(); |
| 316 | exc.as_object().set_attr("object", object, self).unwrap(); |
| 317 | exc.as_object().set_attr("start", start, self).unwrap(); |
| 318 | exc.as_object().set_attr("end", end, self).unwrap(); |
| 319 | exc.as_object().set_attr("reason", reason, self).unwrap(); |
| 320 | exc |
| 321 | } |
| 322 | |
| 323 | // TODO: don't take ownership should make the success path faster |
| 324 | pub fn new_key_error(&self, obj: PyObjectRef) -> PyBaseExceptionRef { |
no test coverage detected