From be04b55f439658283fb751f62051c1b628db6c5c Mon Sep 17 00:00:00 2001 From: Jim Pivarski Date: Mon, 30 Sep 2024 14:22:57 -0500 Subject: [PATCH] done: we are now returning the array build by ak.from_buffers --- header-only/examples/pybind11/demo.cpp | 28 ++------------------------ 1 file changed, 2 insertions(+), 26 deletions(-) diff --git a/header-only/examples/pybind11/demo.cpp b/header-only/examples/pybind11/demo.cpp index ca46e39c66..138e4379e8 100644 --- a/header-only/examples/pybind11/demo.cpp +++ b/header-only/examples/pybind11/demo.cpp @@ -62,32 +62,8 @@ py::object snapshot_builder(const T &builder) { // Write non-contiguous contents to memory. builder.to_buffers(cpp_container); - py::module::import("builtins").attr("print")(py_container); - - // ak.attr("from_buffers")(py_container); - - // // Build Python dictionary containing arrays - // // dtypes not important here as long as they match the underlying buffer - // // as Awkward Array calls `frombuffer` to convert to the correct type - // py::dict container; - // for (auto it: buffers) { - - // py::capsule free_when_done(it.second, [](void *data) { - // uint8_t *dataPtr = reinterpret_cast(data); - // delete[] dataPtr; - // }); - - // uint8_t *data = reinterpret_cast(it.second); - // container[py::str(it.first)] = py::array_t( - // {names_nbytes[it.first]}, - // {sizeof(uint8_t)}, - // data, - // free_when_done - // ); - // } - // return from_buffers(builder.form(), builder.length(), container); - - return py::none(); + // Build Python dictionary containing arrays. + return ak.attr("from_buffers")(builder.form(), builder.length(), py_container); }