equal
deleted
inserted
replaced
26 py: Python, |
26 py: Python, |
27 index: PyObject, |
27 index: PyObject, |
28 revs: PyObject, |
28 revs: PyObject, |
29 ) -> PyResult<HashSet<PyRevision>> { |
29 ) -> PyResult<HashSet<PyRevision>> { |
30 let py_leaked = py_rust_index_to_graph(py, index)?; |
30 let py_leaked = py_rust_index_to_graph(py, index)?; |
|
31 // Safety: we don't leak the "faked" reference out of `UnsafePyLeaked` |
31 let index = &*unsafe { py_leaked.try_borrow(py)? }; |
32 let index = &*unsafe { py_leaked.try_borrow(py)? }; |
32 let mut as_set: HashSet<Revision> = rev_pyiter_collect(py, &revs, index)?; |
33 let mut as_set: HashSet<Revision> = rev_pyiter_collect(py, &revs, index)?; |
33 dagops::retain_heads(index, &mut as_set) |
34 dagops::retain_heads(index, &mut as_set) |
34 .map_err(|e| GraphError::pynew(py, e))?; |
35 .map_err(|e| GraphError::pynew(py, e))?; |
35 Ok(as_set.into_iter().map(Into::into).collect()) |
36 Ok(as_set.into_iter().map(Into::into).collect()) |