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

Method from_getitem_result

crates/vm/src/protocol/iter.rs:178–190  ·  view source on GitHub ↗
(result: PyResult, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

176 }
177
178 pub fn from_getitem_result(result: PyResult, vm: &VirtualMachine) -> PyResult<Self> {
179 match result {
180 Ok(obj) => Ok(Self::Return(obj)),
181 Err(err) if err.fast_isinstance(vm.ctx.exceptions.index_error) => {
182 Ok(Self::StopIteration(None))
183 }
184 Err(err) if err.fast_isinstance(vm.ctx.exceptions.stop_iteration) => {
185 let args = err.get_arg(0);
186 Ok(Self::StopIteration(args))
187 }
188 Err(err) => Err(err),
189 }
190 }
191
192 pub fn into_async_pyresult(self, vm: &VirtualMachine) -> PyResult {
193 match self {

Callers

nothing calls this directly

Calls 3

fast_isinstanceMethod · 0.80
ErrClass · 0.50
get_argMethod · 0.45

Tested by

no test coverage detected