Author pv
Recipients kermode, loewis, mark.dickinson, ncoghlan, pitrou, pv, rupole, teoliphant
Date 2011-02-13.15:09:37
SpamBayes Score 0.0007921
Marked as misclassified No
Message-id <1297609778.0.0.955684185325.issue10181@psf.upfronthosting.co.za>
In-reply-to
Content
[clip]
> This is a different issue.

It is the issue relevant for this discussion. As written in my comment: "So, `bf_releasebuffer` cannot rely on (i) the data in Py_buffer being what `bf_getbuffer` put there, and (ii) getting the same Py_buffer data only once."

> PyObject_GetBuffer() is called twice too: once when creating the
> memoryview, once when calling memory_getbuf.
> So again, bf_getbuffer is called the same number of times as
> bf_releasebuffer.

Yes, it is called twice, but with exactly the same data in Py_buffer.
So I would rather say that bf_releasebuffer is called twice on the Py_buffer returned by the first Getbuffer, and zero times for the buffer returned by the second one.

> > Note that the view.internal pointer is also clobbered above.
> 
> Are you sure? memoryobject.c doesn't touch that pointer at all.

dup_buffer does *dst = *src, which overwrites the view.internal pointer obtained from one GetBuffer call with a pointer obtained from a previous one.
History
Date User Action Args
2011-02-13 15:09:38pvsetrecipients: + pv, loewis, teoliphant, mark.dickinson, ncoghlan, rupole, kermode, pitrou
2011-02-13 15:09:38pvsetmessageid: <1297609778.0.0.955684185325.issue10181@psf.upfronthosting.co.za>
2011-02-13 15:09:37pvlinkissue10181 messages
2011-02-13 15:09:37pvcreate