Skip to content

Fix Vec::to_pyo3_ast #63

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 22, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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