Skip to content

Commit 9b9dd11

Browse files
committed
Add missing with(Iterable)
1 parent 2abf21b commit 9b9dd11

26 files changed

+80
-70
lines changed

stdlib/src/array.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1405,7 +1405,7 @@ mod array {
14051405
internal: PyMutex<PositionIterInternal<PyArrayRef>>,
14061406
}
14071407

1408-
#[pyclass(with(IterNext), flags(HAS_DICT))]
1408+
#[pyclass(with(IterNext, Iterable), flags(HAS_DICT))]
14091409
impl PyArrayIter {
14101410
#[pymethod(magic)]
14111411
fn setstate(&self, state: PyObjectRef, vm: &VirtualMachine) -> PyResult<()> {

stdlib/src/csv.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ mod _csv {
88
function::{ArgIterable, ArgumentError, FromArgs, FuncArgs},
99
match_class,
1010
protocol::{PyIter, PyIterReturn},
11-
types::{IterNext, IterNextIterable},
11+
types::{IterNext, IterNextIterable, Iterable},
1212
AsObject, Py, PyObjectRef, PyPayload, PyResult, TryFromObject, VirtualMachine,
1313
};
1414
use itertools::{self, Itertools};
@@ -166,7 +166,7 @@ mod _csv {
166166
}
167167
}
168168

169-
#[pyclass(with(IterNext))]
169+
#[pyclass(with(IterNext, Iterable))]
170170
impl Reader {}
171171
impl IterNextIterable for Reader {}
172172
impl IterNext for Reader {

stdlib/src/pystruct.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ pub(crate) mod _struct {
1515
function::{ArgBytesLike, ArgMemoryBuffer, PosArgs},
1616
match_class,
1717
protocol::PyIterReturn,
18-
types::{Constructor, IterNext, IterNextIterable},
18+
types::{Constructor, IterNext, IterNextIterable, Iterable},
1919
AsObject, Py, PyObjectRef, PyPayload, PyResult, TryFromObject, VirtualMachine,
2020
};
2121
use crossbeam_utils::atomic::AtomicCell;
@@ -194,7 +194,7 @@ pub(crate) mod _struct {
194194
}
195195
}
196196

197-
#[pyclass(with(IterNext))]
197+
#[pyclass(with(IterNext, Iterable))]
198198
impl UnpackIterator {
199199
#[pymethod(magic)]
200200
fn length_hint(&self) -> usize {

stdlib/src/sqlite.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1377,7 +1377,7 @@ mod _sqlite {
13771377
statement: Option<PyRef<Statement>>,
13781378
}
13791379

1380-
#[pyclass(with(Constructor, IterNext), flags(BASETYPE))]
1380+
#[pyclass(with(Constructor, IterNext, Iterable), flags(BASETYPE))]
13811381
impl Cursor {
13821382
fn new(
13831383
connection: PyRef<Connection>,

vm/src/builtins/asyncgenerator.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use crate::{
66
frame::FrameRef,
77
function::OptionalArg,
88
protocol::PyIterReturn,
9-
types::{Constructor, IterNext, IterNextIterable, Representable, Unconstructible},
9+
types::{Constructor, IterNext, IterNextIterable, Iterable, Representable, Unconstructible},
1010
AsObject, Context, Py, PyObjectRef, PyPayload, PyRef, PyResult, VirtualMachine,
1111
};
1212

@@ -195,7 +195,7 @@ impl PyPayload for PyAsyncGenASend {
195195
}
196196
}
197197

198-
#[pyclass(with(IterNext))]
198+
#[pyclass(with(IterNext, Iterable))]
199199
impl PyAsyncGenASend {
200200
#[pymethod(name = "__await__")]
201201
fn r#await(zelf: PyRef<Self>, _vm: &VirtualMachine) -> PyRef<Self> {
@@ -290,7 +290,7 @@ impl PyPayload for PyAsyncGenAThrow {
290290
}
291291
}
292292

293-
#[pyclass(with(IterNext))]
293+
#[pyclass(with(IterNext, Iterable))]
294294
impl PyAsyncGenAThrow {
295295
#[pymethod(name = "__await__")]
296296
fn r#await(zelf: PyRef<Self>, _vm: &VirtualMachine) -> PyRef<Self> {

vm/src/builtins/bytearray.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -891,7 +891,7 @@ impl PyPayload for PyByteArrayIterator {
891891
}
892892
}
893893

894-
#[pyclass(with(Constructor, IterNext))]
894+
#[pyclass(with(Constructor, IterNext, Iterable))]
895895
impl PyByteArrayIterator {
896896
#[pymethod(magic)]
897897
fn length_hint(&self) -> usize {

vm/src/builtins/bytes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -688,7 +688,7 @@ impl PyPayload for PyBytesIterator {
688688
}
689689
}
690690

691-
#[pyclass(with(Constructor, IterNext))]
691+
#[pyclass(with(Constructor, IterNext, Iterable))]
692692
impl PyBytesIterator {
693693
#[pymethod(magic)]
694694
fn length_hint(&self) -> usize {

vm/src/builtins/coroutine.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use crate::{
55
frame::FrameRef,
66
function::OptionalArg,
77
protocol::PyIterReturn,
8-
types::{Constructor, IterNext, IterNextIterable, Representable, Unconstructible},
8+
types::{Constructor, IterNext, IterNextIterable, Iterable, Representable, Unconstructible},
99
AsObject, Context, Py, PyObjectRef, PyPayload, PyRef, PyResult, VirtualMachine,
1010
};
1111

@@ -128,7 +128,7 @@ impl PyPayload for PyCoroutineWrapper {
128128
}
129129
}
130130

131-
#[pyclass(with(IterNext))]
131+
#[pyclass(with(IterNext, Iterable))]
132132
impl PyCoroutineWrapper {
133133
#[pymethod]
134134
fn send(&self, val: PyObjectRef, vm: &VirtualMachine) -> PyResult<PyIterReturn> {

vm/src/builtins/dict.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -839,7 +839,7 @@ macro_rules! dict_view {
839839
}
840840
}
841841

842-
#[pyclass(with(Constructor, IterNext))]
842+
#[pyclass(with(Constructor, IterNext, Iterable))]
843843
impl $iter_name {
844844
fn new(dict: PyDictRef) -> Self {
845845
$iter_name {
@@ -912,7 +912,7 @@ macro_rules! dict_view {
912912
}
913913
}
914914

915-
#[pyclass(with(Constructor, IterNext))]
915+
#[pyclass(with(Constructor, IterNext, Iterable))]
916916
impl $reverse_iter_name {
917917
fn new(dict: PyDictRef) -> Self {
918918
let size = dict.size();

vm/src/builtins/enumerate.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use crate::{
77
convert::ToPyObject,
88
function::OptionalArg,
99
protocol::{PyIter, PyIterReturn},
10-
types::{Constructor, IterNext, IterNextIterable},
10+
types::{Constructor, IterNext, IterNextIterable, Iterable},
1111
AsObject, Context, Py, PyObjectRef, PyPayload, PyResult, VirtualMachine,
1212
};
1313
use num_bigint::BigInt;
@@ -52,7 +52,7 @@ impl Constructor for PyEnumerate {
5252
}
5353
}
5454

55-
#[pyclass(with(Py, IterNext, Constructor), flags(BASETYPE))]
55+
#[pyclass(with(Py, IterNext, Iterable, Constructor), flags(BASETYPE))]
5656
impl PyEnumerate {
5757
#[pyclassmethod(magic)]
5858
fn class_getitem(cls: PyTypeRef, args: PyObjectRef, vm: &VirtualMachine) -> PyGenericAlias {
@@ -97,7 +97,7 @@ impl PyPayload for PyReverseSequenceIterator {
9797
}
9898
}
9999

100-
#[pyclass(with(IterNext))]
100+
#[pyclass(with(IterNext, Iterable))]
101101
impl PyReverseSequenceIterator {
102102
pub fn new(obj: PyObjectRef, len: usize) -> Self {
103103
let position = len.saturating_sub(1);

0 commit comments

Comments
 (0)