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

Method extend

crates/stdlib/src/array.rs:760–774  ·  view source on GitHub ↗
(zelf: &Py<Self>, obj: PyObjectRef, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

758
759 #[pymethod]
760 fn extend(zelf: &Py<Self>, obj: PyObjectRef, vm: &VirtualMachine) -> PyResult<()> {
761 let mut w = zelf.try_resizable(vm)?;
762 if zelf.is(&obj) {
763 w.imul(2, vm)
764 } else if let Some(array) = obj.downcast_ref::<Self>() {
765 w.iadd(&array.read(), vm)
766 } else {
767 let iter = ArgIterable::try_from_object(vm, obj)?;
768 // zelf.extend_from_iterable(iter, vm)
769 for obj in iter.iter(vm)? {
770 w.push(obj?, vm)?;
771 }
772 Ok(())
773 }
774 }
775
776 fn _wchar_bytes_to_string(
777 bytes: &[u8],

Callers 3

a2b_uuFunction · 0.45
begin_transactionMethod · 0.45
load_default_certsMethod · 0.45

Calls 7

try_resizableMethod · 0.80
isMethod · 0.80
iaddMethod · 0.80
imulMethod · 0.45
readMethod · 0.45
iterMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected