PyIterator creates a SIGSEGV when passed an integer.
pacman -S pythonrustc --version): rustc 1.36.0-nightly (7158ed9cb 2019-05-15)version = "0.x.y" with git = "https://github.com/PyO3/pyo3")? yes, yesThe following program will panic:
extern crate pyo3;
use pyo3::prelude::*;
use pyo3::types::PyIterator;
fn main() {
let gil = Python::acquire_gil();
let py = gil.python();
let obj = 1.into_object(py);
assert!(PyIterator::from_object(py, &obj).is_err());
}
with Cargo.toml:
[dependencies]
pyo3 = { git = "https://github.com/PyO3/pyo3" }
This is because the return value from PyObject_GetIter in https://github.com/PyO3/pyo3/blob/master/src/types/iterator.rs#L42 is not checked for NULL.
I also don't understand why there is an additional PyIter_Check below (referring to #71)...
Most helpful comment
This is because the return value from
PyObject_GetIterin https://github.com/PyO3/pyo3/blob/master/src/types/iterator.rs#L42 is not checked forNULL.I also don't understand why there is an additional
PyIter_Checkbelow (referring to #71)...