[Numpy-discussion] Testing the python buffer protocol (bf_getbuffer / tp_as_buffer)
Soeren Sonnenburg
sonne at debian.org
Sat Dec 17 18:49:56 EST 2011
On Sat, 2011-12-17 at 15:29 +0100, Pauli Virtanen wrote:
> 17.12.2011 09:42, Soeren Sonnenburg kirjoitti:
> > Doesn't work, complaining that the object has no __buffer__ attribute.
> >
> > Digging into the numpy c code it seems numpy doesn't even support the
> > buffer protocol but only the deprecated (old) one
> > http://docs.python.org/c-api/objbuffer.html .
> [clip]
>
> Since Numpy version 1.5, the new buffer protocol is supported.
I've looked at the source code of numpy 1.6.1 and couldn't find the
respective code... I guess I must be doing something wrong but there
really was no call to PyObject_CheckBuffer() ...
The problem is I don't really know what is supposed to happen if the new
buffer protocol is supported by some class named say Foo. Could I then
do
x=Foo([1,2,3])
numpy.array([2,2,2])+x
and such operations?
Soeren
--
For the one fact about the future of which we can be certain is that it
will be utterly fantastic. -- Arthur C. Clarke, 1962
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20111218/267c3532/attachment.sig>
More information about the NumPy-Discussion
mailing list