Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Remove redundant __iter__ pymethods from PyFuture and PyTask
Both types already have impl Iterable, so the direct #[pymethod]
__iter__ definitions were duplicates. Enable __iter__/__next__
guards in derive to prevent future direct definitions.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
  • Loading branch information
moreal and claude committed Mar 16, 2026
commit ecf9e2177ff55ccc00dcd6205a6653e9eec337de
6 changes: 3 additions & 3 deletions crates/derive-impl/src/pyclass.rs
Original file line number Diff line number Diff line change
Expand Up @@ -987,9 +987,9 @@ where
// ("__getitem__", "AsMapping (or AsSequence)"),
// ("__setitem__", "AsMapping (or AsSequence)"),
// ("__delitem__", "AsMapping (or AsSequence)"),
// IterNext trait
// ("__iter__", "IterNext"),
// ("__next__", "IterNext"),
// Iterable/IterNext traits
("__iter__", "Iterable"),
("__next__", "IterNext"),
// Comparable trait
("__eq__", "Comparable"),
("__ne__", "Comparable"),
Expand Down
12 changes: 0 additions & 12 deletions crates/stdlib/src/_asyncio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -764,11 +764,6 @@ pub(crate) mod _asyncio {
Ok(())
}

#[pymethod]
fn __iter__(zelf: PyRef<Self>, vm: &VirtualMachine) -> PyResult<PyFutureIter> {
Self::__await__(zelf, vm)
}

#[pymethod]
fn __await__(zelf: PyRef<Self>, _vm: &VirtualMachine) -> PyResult<PyFutureIter> {
Ok(PyFutureIter {
Expand Down Expand Up @@ -1828,13 +1823,6 @@ pub(crate) mod _asyncio {
}
}

#[pymethod]
fn __iter__(zelf: PyRef<Self>, _vm: &VirtualMachine) -> PyResult<PyFutureIter> {
Ok(PyFutureIter {
future: PyRwLock::new(Some(zelf.into())),
})
}

#[pymethod]
fn __await__(zelf: PyRef<Self>, _vm: &VirtualMachine) -> PyResult<PyFutureIter> {
Ok(PyFutureIter {
Expand Down