| 261 | } |
| 262 | |
| 263 | pub fn new_unicode_decode_error_real( |
| 264 | &self, |
| 265 | encoding: PyStrRef, |
| 266 | object: PyBytesRef, |
| 267 | start: usize, |
| 268 | end: usize, |
| 269 | reason: PyStrRef, |
| 270 | ) -> PyBaseExceptionRef { |
| 271 | let start = self.ctx.new_int(start); |
| 272 | let end = self.ctx.new_int(end); |
| 273 | let exc = self.new_exception( |
| 274 | self.ctx.exceptions.unicode_decode_error.to_owned(), |
| 275 | vec![ |
| 276 | encoding.clone().into(), |
| 277 | object.clone().into(), |
| 278 | start.clone().into(), |
| 279 | end.clone().into(), |
| 280 | reason.clone().into(), |
| 281 | ], |
| 282 | ); |
| 283 | exc.as_object() |
| 284 | .set_attr("encoding", encoding, self) |
| 285 | .unwrap(); |
| 286 | exc.as_object().set_attr("object", object, self).unwrap(); |
| 287 | exc.as_object().set_attr("start", start, self).unwrap(); |
| 288 | exc.as_object().set_attr("end", end, self).unwrap(); |
| 289 | exc.as_object().set_attr("reason", reason, self).unwrap(); |
| 290 | exc |
| 291 | } |
| 292 | |
| 293 | pub fn new_unicode_encode_error_real( |
| 294 | &self, |