On, Sun Aug 18, 2013, Lenard Lindstrom wrote: > On 13-08-17 12:28 AM, Marcus von Appen wrote: > > On, Sat Aug 17, 2013, Lenard Lindstrom wrote: > > > >> Ctypes may be the way to go on PyPy, but it is slow in CPython. It lacks > >> new buffer support. Well, ctype types have buffers, but they don't work > >> with NumPy. > > Take a look at > > https://bitbucket.org/marcusva/py-sdl2/src/963b26e2110449a453efa7fa45328c0062c72697/sdl2/ext/pixelaccess.py?at=default > > > > Accessing ctypes buffers or exposing ctypes buffers to Numpy is not a > > problem. > > > > Cheers > > Marcus > Hi Marcus, > > Is there a way to create a custom bf_releasebuffer function for a ctype > object? When exporting an SDL_Surface pixel buffer using the 3118 (new) > buffer interface, I would like the release callback to unlock the > surface, rather than use a NumPy array's __del__ method.
The PEP does not specify anything like that and I did not stumble across such a feature. The only thing, I am aware f is the slightly enhanced mechanism for dealing with struct.pack/unpack in regards to buffers, which however does not help here. Cheers Marcus
pgpF5STS_Xy5k.pgp
Description: PGP signature