implement aiter

the caller is expected to make sure that the passed in object does in
fact supports the protocol

relates #3609
This commit is contained in:
sum12
2022-04-19 20:15:28 +02:00
parent 9a8e3856b2
commit 8455c741a6

View File

@@ -426,6 +426,11 @@ mod builtins {
}
}
#[pyfunction]
fn aiter(iter_target: PyObjectRef, vm: &VirtualMachine) -> PyResult {
vm.call_special_method(iter_target, "__aiter__", ())
}
#[pyfunction]
fn len(obj: PyObjectRef, vm: &VirtualMachine) -> PyResult<usize> {
obj.length(vm)