Skip to content

Commit

Permalink
Add changelog entry and test
Browse files Browse the repository at this point in the history
  • Loading branch information
davidhewitt committed Oct 12, 2020
1 parent 7b6fb95 commit f89e2bf
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ PyO3 versions, please see the [migration guide](https://pyo3.rs/master/migration
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [Unreleased]
### Changed
- Change `PyIterator` to be consistent with other native types: it is now used as `&PyIterator` instead of `PyIterator<'a>`. [#1176](https://github.com/PyO3/pyo3/pull/1176)

## [0.12.2] - 2020-10-12
### Added
- Add support for keyword-only arguments without default values in `#[pyfunction]`. [#1209](https://github.com/PyO3/pyo3/pull/1209)
Expand Down
12 changes: 10 additions & 2 deletions src/types/iterator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,7 @@ mod tests {
use crate::exceptions::PyTypeError;
use crate::gil::GILPool;
use crate::types::{PyDict, PyList};
use crate::Python;
use crate::ToPyObject;
use crate::{Python, Py, PyAny, ToPyObject, PyTryFrom};
use indoc::indoc;

#[test]
Expand Down Expand Up @@ -199,4 +198,13 @@ mod tests {

assert!(err.is_instance::<PyTypeError>(py))
}

#[test]
fn iterator_try_from() {
let gil_guard = Python::acquire_gil();
let py = gil_guard.python();
let obj: Py<PyAny> = vec![10, 20].to_object(py).as_ref(py).iter().unwrap().into();
let iter: &PyIterator = PyIterator::try_from(obj.as_ref(py)).unwrap();
assert_eq!(obj, iter.into());
}
}

0 comments on commit f89e2bf

Please sign in to comment.