diff --git a/newsfragments/2632.changed.md b/newsfragments/2632.changed.md new file mode 100644 index 00000000000..8a957fa0ba7 --- /dev/null +++ b/newsfragments/2632.changed.md @@ -0,0 +1,11 @@ +`impl FromPyObject for Vec` will accept any Python object that can be turned into an iterator via Python's built-in `iter` function. It will also not reject `str` anymore which can be iterated as a sequence of `str` objects, i.e. [#2500](https://github.com/PyO3/pyo3/pull/2500) was reverted. Please use a type like + +```rust +#[derive(FromPyObject)] +pub enum OneOrMany<'py> { + One(&'py PyString), + Many(Vec<&'py PyString>), +} +``` + +if you would like to work around this edge case for callers of your API.