mirror of
https://github.com/RustPython/Parser.git
synced 2025-08-04 02:39:22 +00:00
Fix Vec::to_pyo3_ast
This commit is contained in:
parent
d4084fb17a
commit
96199ccb76
1 changed files with 5 additions and 5 deletions
|
@ -38,11 +38,11 @@ impl<T: ToPyo3Ast> ToPyo3Ast for Option<T> {
|
||||||
|
|
||||||
impl<T: ToPyo3Ast> ToPyo3Ast for Vec<T> {
|
impl<T: ToPyo3Ast> ToPyo3Ast for Vec<T> {
|
||||||
fn to_pyo3_ast(&self, py: Python) -> PyResult<Py<PyAny>> {
|
fn to_pyo3_ast(&self, py: Python) -> PyResult<Py<PyAny>> {
|
||||||
let list = PyList::empty(py);
|
let elts = self
|
||||||
for item in self {
|
.iter()
|
||||||
let py_item = item.to_pyo3_ast(py)?;
|
.map(|item| item.to_pyo3_ast(py))
|
||||||
list.append(py_item)?;
|
.collect::<Result<Vec<_>, _>>()?;
|
||||||
}
|
let list = PyList::new(py, elts);
|
||||||
Ok(list.into())
|
Ok(list.into())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue