rust-cpython icon indicating copy to clipboard operation
rust-cpython copied to clipboard

create PyBuffer from rust code

Open xd009642 opened this issue 5 years ago • 1 comments

So I've had experience before creating python bindings with the C++ library pybind11 where I'm able to return python buffers but I can't figure out how to do the same with rust-cpython

xd009642 avatar Nov 04 '19 21:11 xd009642

@xd009642 sorry for the late reply, but you mean implementing Buffer Object Structures for Python Object defined with py_class!, right?

I don't see anything supporting that in rust-cpython. By contrast, cpython::PyBuffer provide methods for buffer consumption in the sense of the Buffer Protocol

I might be myself interested. If I understand correctly, implementing tp_as_buffer would be a good way to expose large array-like data structures to the Python interpreter.

gracinet avatar Nov 29 '19 14:11 gracinet