Skip to content

Commit

Permalink
Address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
c410-f3r committed Feb 29, 2020
1 parent 3a68f45 commit f980d2c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
11 changes: 2 additions & 9 deletions src/types/list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,17 +183,10 @@ macro_rules! array_impls {
$(
impl<T> IntoPy<PyObject> for [T; $N]
where
T: Copy + IntoPy<PyObject>,
T: ToPyObject
{
fn into_py(self, py: Python) -> PyObject {
unsafe {
let ptr = ffi::PyList_New(self.len() as Py_ssize_t);
for (i, e) in self.iter().copied().enumerate() {
let obj = e.into_py(py).into_ptr();
ffi::PyList_SetItem(ptr, i as Py_ssize_t, obj);
}
PyObject::from_owned_ptr_or_panic(py, ptr)
}
self.as_ref().to_object(py)
}
}
)+
Expand Down
2 changes: 1 addition & 1 deletion src/types/sequence.rs
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ where
T: FromPyObject<'s>,
{
let seq = <PySequence as PyTryFrom>::try_from(obj)?;
if (seq.len()? as usize) != slice.len() {
if seq.len()? as usize != slice.len() {
return Err(exceptions::BufferError::py_err(
"Slice length does not match buffer length.",
));
Expand Down

0 comments on commit f980d2c

Please sign in to comment.