rust/hg-cpython/src/revlog.rs
changeset 44011 c627f1b2f3c3
parent 44010 2728fcb8127c
child 44012 443dc1655923
--- a/rust/hg-cpython/src/revlog.rs	Fri Dec 13 19:52:26 2019 +0100
+++ b/rust/hg-cpython/src/revlog.rs	Thu Dec 12 18:11:44 2019 +0100
@@ -15,7 +15,10 @@
 
 /// Return a Struct implementing the Graph trait
 pub(crate) fn pyindex_to_graph(py: Python, index: PyObject) -> PyResult<cindex::Index> {
-    cindex::Index::new(py, index)
+    match index.extract::<MixedIndex>(py) {
+        Ok(midx) => Ok(midx.clone_cindex(py)),
+        Err(_) => cindex::Index::new(py, index),
+    }
 }
 
 py_class!(pub class MixedIndex |py| {