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

Function get_int_field

crates/vm/src/stdlib/_ast.rs:86–95  ·  view source on GitHub ↗
(
    vm: &VirtualMachine,
    obj: &PyObject,
    field: &'static str,
    typ: &str,
)

Source from the content-addressed store, hash-verified

84}
85
86fn get_int_field(
87 vm: &VirtualMachine,
88 obj: &PyObject,
89 field: &'static str,
90 typ: &str,
91) -> PyResult<PyRefExact<PyInt>> {
92 get_node_field(vm, obj, field, typ)?
93 .downcast_exact(vm)
94 .map_err(|_| vm.new_type_error(format!(r#"field "{field}" must have integer type"#)))
95}
96
97struct PySourceRange {
98 start: PySourceLocation,

Callers 1

range_from_objectFunction · 0.85

Calls 2

get_node_fieldFunction · 0.85
downcast_exactMethod · 0.80

Tested by

no test coverage detected