Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions newsfragments/5539.changed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Expose types::iterator::PySendResult in public API
3 changes: 3 additions & 0 deletions src/types/iterator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,13 @@ impl PyIterator {
}
}

/// Outcomes from sending a value into a python generator
#[derive(Debug)]
#[cfg(all(not(PyPy), Py_3_10))]
pub enum PySendResult<'py> {
/// The generator yielded a new value
Next(Bound<'py, PyAny>),
/// The generator completed, returning a (possibly None) final value
Return(Bound<'py, PyAny>),
}

Expand Down
2 changes: 2 additions & 0 deletions src/types/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ pub use self::function::PyFunction;
#[cfg(Py_3_9)]
pub use self::genericalias::PyGenericAlias;
pub use self::iterator::PyIterator;
#[cfg(all(not(PyPy), Py_3_10))]
pub use self::iterator::PySendResult;
pub use self::list::{PyList, PyListMethods};
pub use self::mapping::{PyMapping, PyMappingMethods};
pub use self::mappingproxy::PyMappingProxy;
Expand Down
Loading