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

Method popitem

crates/vm/src/builtins/dict.rs:398–407  ·  view source on GitHub ↗
(&self, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

396
397 #[pymethod]
398 fn popitem(&self, vm: &VirtualMachine) -> PyResult<(PyObjectRef, PyObjectRef)> {
399 let (key, value) = self.entries.pop_back().ok_or_else(|| {
400 let err_msg = vm
401 .ctx
402 .new_str(ascii!("popitem(): dictionary is empty"))
403 .into();
404 vm.new_key_error(err_msg)
405 })?;
406 Ok((key, value))
407 }
408
409 #[pyclassmethod]
410 fn __class_getitem__(cls: PyTypeRef, args: PyObjectRef, vm: &VirtualMachine) -> PyGenericAlias {

Callers

nothing calls this directly

Calls 4

ok_or_elseMethod · 0.80
pop_backMethod · 0.80
new_key_errorMethod · 0.80
new_strMethod · 0.45

Tested by

no test coverage detected