Merge branch 'master' of github.com:PyO3/pyo3
This commit is contained in:
commit
95915b55dd
|
@ -237,10 +237,10 @@ impl <'source, T> FromPyObject<'source> for Vec<T>
|
||||||
fn extract_sequence<'s, T>(obj: &'s PyObjectRef) -> PyResult<Vec<T>> where T: FromPyObject<'s>
|
fn extract_sequence<'s, T>(obj: &'s PyObjectRef) -> PyResult<Vec<T>> where T: FromPyObject<'s>
|
||||||
{
|
{
|
||||||
let seq = PySequence::try_from(obj)?;
|
let seq = PySequence::try_from(obj)?;
|
||||||
let mut v = Vec::new();
|
let mut v = Vec::with_capacity(seq.len().unwrap_or(0) as usize);
|
||||||
for item in try!(seq.iter()) {
|
for item in seq.iter()? {
|
||||||
let item = try!(item);
|
let item = try!(item);
|
||||||
v.push(try!(item.extract::<T>()));
|
v.push(item.extract::<T>()?);
|
||||||
}
|
}
|
||||||
Ok(v)
|
Ok(v)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue