D6232: rust-discovery: cpython bindings for the core logic

Yuya Nishihara yuya at tcha.org
Thu Apr 18 19:16:55 EDT 2019


> +    def addinfo(&self, sample: PyObject) -> PyResult<PyObject> {
> +        let mut missing: Vec<Revision> = Vec::new();
> +        let mut common: Vec<Revision> = Vec::new();
> +        for info in sample.iter(py)? { // info is a pair (Revision, bool)
> +            let mut revknown = info?.iter(py)?;
> +            let rev: Revision = revknown.next().unwrap()?.extract(py)?;
> +            let known: bool = revknown.next().unwrap()?.extract(py)?;

Just to confirm. Can we be sure that this `unwrap()` never fails? I mean if
we passed in an empty tuple for example, what would happen?


More information about the Mercurial-devel mailing list