We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d74a1d5 commit 5fdf62aCopy full SHA for 5fdf62a
vm/src/stdlib/builtins.rs
@@ -12,6 +12,7 @@ mod builtins {
12
use crate::compile;
13
use crate::{
14
builtins::{
15
+ asyncgenerator::PyAsyncGen,
16
enumerate::PyReverseSequenceIterator,
17
function::{PyCellRef, PyFunctionRef},
18
int::PyIntRef,
@@ -428,7 +429,11 @@ mod builtins {
428
429
430
#[pyfunction]
431
fn aiter(iter_target: PyObjectRef, vm: &VirtualMachine) -> PyResult {
- vm.call_special_method(iter_target, "__aiter__", ())
432
+ if iter_target.payload_is::<PyAsyncGen>() {
433
+ vm.call_special_method(iter_target, "__aiter__", ())
434
+ } else {
435
+ Err(vm.new_type_error("wrong argument type".to_owned()))
436
+ }
437
}
438
439
0 commit comments