From e3e9bc90c41dd4678a0ba92df268265d0c0b61b1 Mon Sep 17 00:00:00 2001 From: Ziyang Hu Date: Fri, 9 Jun 2023 00:09:25 +0800 Subject: [PATCH] support python tuples --- cozo-lib-python/src/lib.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cozo-lib-python/src/lib.rs b/cozo-lib-python/src/lib.rs index f5533ffb..1d1cccce 100644 --- a/cozo-lib-python/src/lib.rs +++ b/cozo-lib-python/src/lib.rs @@ -58,6 +58,13 @@ fn py_to_value(ob: &PyAny) -> PyResult { DataValue::Bytes(b.as_bytes().to_vec()) } else if let Ok(b) = ob.downcast::() { DataValue::Bytes(unsafe { b.as_bytes() }.to_vec()) + } else if let Ok(l) = ob.downcast::() { + let mut coll = Vec::with_capacity(l.len()); + for el in l { + let el = py_to_value(el)?; + coll.push(el) + } + DataValue::List(coll) } else if let Ok(l) = ob.downcast::() { let mut coll = Vec::with_capacity(l.len()); for el in l {