Re: pygobject and buffers
- From: jcupitt gmail com
- Cc: "python-hackers-list gnome org" <python-hackers-list gnome org>
- Subject: Re: pygobject and buffers
- Date: Mon, 8 Sep 2014 21:36:22 +0100
On 4 September 2014 10:31, PICCA Frederic-Emmanuel
<frederic-emmanuel picca synchrotron-soleil fr> wrote:
I wrote a tiny Python module that converts from our GObject-based buffer
class to a NumPy array [1]. Works okay but requires a memcpy.
[1] https://github.com/ufo-kit/ufo-python-tools/blob/master/src/ufo.c
as an user of gobject introspection for my own C library.
it would be really nice if out of the box it should be possible to expose a C array as a numpy array with a
dedicated gobject annotation.
I think, if the GArray wrapping were added, you could do this yourself
very efficiently with a couple of lines of Python. A GArray can just
be a pointer to a ref-counted area of memory, so it would provide the
abstraction you need to move large binary objects around very quickly,
as long as the libraries you pass them between agree on the format.
John
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]