Skip to content

Commit 521d22f

Browse files
committed
remove allow_any_iter
1 parent fdb0a7c commit 521d22f

File tree

3 files changed

+1
-7
lines changed

3 files changed

+1
-7
lines changed

pydantic_core/core_schema.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1188,7 +1188,6 @@ class ListSchema(TypedDict, total=False):
11881188
min_length: int
11891189
max_length: int
11901190
strict: bool
1191-
allow_any_iter: bool
11921191
ref: str
11931192
metadata: Any
11941193
serialization: IncExSeqOrElseSerSchema
@@ -1200,7 +1199,6 @@ def list_schema(
12001199
min_length: int | None = None,
12011200
max_length: int | None = None,
12021201
strict: bool | None = None,
1203-
allow_any_iter: bool | None = None,
12041202
ref: str | None = None,
12051203
metadata: Any = None,
12061204
serialization: IncExSeqOrElseSerSchema | None = None,
@@ -1221,7 +1219,6 @@ def list_schema(
12211219
min_length: The value must be a list with at least this many items
12221220
max_length: The value must be a list with at most this many items
12231221
strict: The value must be a list with exactly this many items
1224-
allow_any_iter: Whether the value can be any iterable
12251222
ref: optional unique identifier of the schema, used to reference the schema in other places
12261223
metadata: Any other information you want to include with the schema, not used by pydantic-core
12271224
serialization: Custom serialization schema
@@ -1232,7 +1229,6 @@ def list_schema(
12321229
min_length=min_length,
12331230
max_length=max_length,
12341231
strict=strict,
1235-
allow_any_iter=allow_any_iter,
12361232
ref=ref,
12371233
metadata=metadata,
12381234
serialization=serialization,

src/validators/list.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ use super::{build_validator, BuildValidator, CombinedValidator, Definitions, Def
1616
#[derive(Debug, Clone)]
1717
pub struct ListValidator {
1818
strict: bool,
19-
_allow_any_iter: bool,
2019
item_validator: Box<CombinedValidator>,
2120
min_length: usize,
2221
max_length: Option<usize>,
@@ -57,7 +56,6 @@ impl BuildValidator for ListValidator {
5756
let name = format!("{}[{inner_name}]", Self::EXPECTED_TYPE);
5857
Ok(Self {
5958
strict: crate::build_tools::is_strict(schema, config)?,
60-
_allow_any_iter: schema.get_as(pyo3::intern!(py, "allow_any_iter"))?.unwrap_or(false),
6159
item_validator: Box::new(item_validator),
6260
min_length: schema.get_as(pyo3::intern!(py, "min_length"))?.unwrap_or_default(),
6361
max_length: schema.get_as(pyo3::intern!(py, "max_length"))?,

tests/validators/test_list.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ def __next__(self):
416416
else:
417417
raise RuntimeError('broken')
418418

419-
v = SchemaValidator({'type': 'list', 'items_schema': {'type': items_schema}, 'allow_any_iter': True})
419+
v = SchemaValidator({'type': 'list', 'items_schema': {'type': items_schema}})
420420
assert v.validate_python(BadIter(True)) == [1]
421421
with pytest.raises(ValidationError) as exc_info:
422422
v.validate_python(BadIter(False))

0 commit comments

Comments
 (0)