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

Function update_unicode_error_attrs

crates/vm/src/codecs.rs:1113–1126  ·  view source on GitHub ↗
(
    err: &PyObject,
    start: usize,
    end: usize,
    reason: Option<&str>,
    vm: &VirtualMachine,
)

Source from the content-addressed store, hash-verified

1111}
1112
1113fn update_unicode_error_attrs(
1114 err: &PyObject,
1115 start: usize,
1116 end: usize,
1117 reason: Option<&str>,
1118 vm: &VirtualMachine,
1119) -> PyResult<()> {
1120 err.set_attr("start", start.to_pyobject(vm), vm)?;
1121 err.set_attr("end", end.to_pyobject(vm), vm)?;
1122 if let Some(reason) = reason {
1123 err.set_attr("reason", reason.to_pyobject(vm), vm)?;
1124 }
1125 Ok(())
1126}
1127
1128#[inline]
1129fn is_encode_err(err: &PyObject, vm: &VirtualMachine) -> bool {

Callers 2

error_encodingMethod · 0.85
error_decodingMethod · 0.85

Calls 2

set_attrMethod · 0.45
to_pyobjectMethod · 0.45

Tested by

no test coverage detected