mirror of
https://github.com/RustPython/RustPython.git
synced 2026-06-09 22:49:57 +09:00
tp_iternext for coroutine_wrapper
This commit is contained in:
@@ -122,7 +122,7 @@ impl PyValue for PyCoroutineWrapper {
|
||||
}
|
||||
}
|
||||
|
||||
#[pyimpl]
|
||||
#[pyimpl(with(PyIter))]
|
||||
impl PyCoroutineWrapper {
|
||||
#[pymethod]
|
||||
fn send(&self, val: PyObjectRef, vm: &VirtualMachine) -> PyResult {
|
||||
@@ -141,6 +141,12 @@ impl PyCoroutineWrapper {
|
||||
}
|
||||
}
|
||||
|
||||
impl PyIter for PyCoroutineWrapper {
|
||||
fn next(zelf: &PyRef<Self>, vm: &VirtualMachine) -> PyResult {
|
||||
zelf.send(vm.ctx.none(), vm)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn init(ctx: &PyContext) {
|
||||
PyCoroutine::extend_class(ctx, &ctx.types.coroutine_type);
|
||||
PyCoroutineWrapper::extend_class(ctx, &ctx.types.coroutine_wrapper_type);
|
||||
|
||||
Reference in New Issue
Block a user