From 99c4c90b63f327e280f713192d6d65a7979c2d89 Mon Sep 17 00:00:00 2001 From: Christophe Troestler Date: Thu, 19 Mar 2026 22:51:42 +0100 Subject: [PATCH 1/2] Implement ToPyArray for Vec --- src/convert.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/convert.rs b/src/convert.rs index dfb59d396..5138064d8 100644 --- a/src/convert.rs +++ b/src/convert.rs @@ -145,6 +145,15 @@ impl ToPyArray for [T] { } } +impl ToPyArray for Vec { + type Item = T; + type Dim = Ix1; + + fn to_pyarray<'py>(&self, py: Python<'py>) -> Bound<'py, PyArray> { + PyArray::from_slice(py, self.as_slice()) + } +} + impl ToPyArray for ArrayBase where S: Data, From 95f9e0c602ca25da204cdc0644ef043bbab17983 Mon Sep 17 00:00:00 2001 From: Christophe Troestler Date: Thu, 19 Mar 2026 23:14:06 +0100 Subject: [PATCH 2/2] Implement ToPyArray for [T; N] --- src/convert.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/convert.rs b/src/convert.rs index 5138064d8..aac467d91 100644 --- a/src/convert.rs +++ b/src/convert.rs @@ -154,6 +154,15 @@ impl ToPyArray for Vec { } } +impl ToPyArray for [T; N] { + type Item = T; + type Dim = Ix1; + + fn to_pyarray<'py>(&self, py: Python<'py>) -> Bound<'py, PyArray> { + PyArray::from_slice(py, self.as_slice()) + } +} + impl ToPyArray for ArrayBase where S: Data,