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

Method new_unicode_decode_error_real

crates/vm/src/vm/vm_new.rs:263–291  ·  view source on GitHub ↗
(
        &self,
        encoding: PyStrRef,
        object: PyBytesRef,
        start: usize,
        end: usize,
        reason: PyStrRef,
    )

Source from the content-addressed store, hash-verified

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,

Callers 2

error_decodingMethod · 0.80
decode_code_page_errorsFunction · 0.80

Calls 6

new_exceptionMethod · 0.80
new_intMethod · 0.45
to_ownedMethod · 0.45
unwrapMethod · 0.45
set_attrMethod · 0.45
as_objectMethod · 0.45

Tested by

no test coverage detected