Stefan Behnel <stefan...@behnel.de> wrote:
> I keep failing to see the interest in making this an error in the first
> place.

First, it is meant to guard against random pointers in the view.obj
field, precisely because view.obj was undocumented and exporters
might not fill in the field.

Then, as I said, the exporter is exposed on the Python level now:

>>> exporter = b'123'
>>> x = memoryview(exporter)
>>> x.obj == exporter 
True
>>> x.obj
b'123'


> Why would the object that bf_getbuffer() is being called on have to
> be identical with the one that exports the buffer?

It doesn't have to be. This is now possible:

>>> from _testbuffer import *
>>> exporter = b'123'
>>> nd = ndarray(exporter)
>>> m = memoryview(nd)
>>> nd.obj
b'123'
>>> m.obj
<ndarray object at 0x7fbef33677d8>



Stefan Krah


_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to