[Numpy-discussion] Should object arrays have a buffer interface?

Andreas Klöckner lists@informa.tiker....
Sun Dec 28 18:23:28 CST 2008


Hi all,

I don't think PyObject pointers should be accessible via the buffer interface. 
I'd throw an error, but maybe a (silenceable) warning would do. Would have 
saved me some bug-hunting.

>>> import numpy
>>> numpy.array([55, (33,)], dtype=object)
>>> x = numpy.array([55, (33,)], dtype=object)
>>> x
array([55, (33,)], dtype=object)
>>> buffer(x)
<read-only buffer for 0x8496f48, size -1, offset 0 at 0x850b060>
>>> str(buffer(x))
'\xb0\x1c\x17\x08l\x89\xd7\xb7'
>>> numpy.__version__
'1.1.0'

Opinions?

Andreas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
Url : http://projects.scipy.org/pipermail/numpy-discussion/attachments/20081228/296de30a/attachment.bin 


More information about the Numpy-discussion mailing list