Skip to content

Commit

Permalink
Fix Vec::to_pyo3_ast (#63)
Browse files Browse the repository at this point in the history
  • Loading branch information
youknowone authored May 22, 2023
1 parent d4084fb commit e1f02fc
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions ast/src/pyo3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ impl<T: ToPyo3Ast> ToPyo3Ast for Option<T> {

impl<T: ToPyo3Ast> ToPyo3Ast for Vec<T> {
fn to_pyo3_ast(&self, py: Python) -> PyResult<Py<PyAny>> {
let list = PyList::empty(py);
for item in self {
let py_item = item.to_pyo3_ast(py)?;
list.append(py_item)?;
}
let elts = self
.iter()
.map(|item| item.to_pyo3_ast(py))
.collect::<Result<Vec<_>, _>>()?;
let list = PyList::new(py, elts);
Ok(list.into())
}
}
Expand Down

0 comments on commit e1f02fc

Please sign in to comment.