This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author kermode
Recipients kermode, lemburg, loewis, pitrou, vstinner
Date 2010-09-28.16:45:56
SpamBayes Score 5.664736e-05
Marked as misclassified No
Message-id <1285692359.13.0.278085270749.issue9602@psf.upfronthosting.co.za>
In-reply-to
Content
>I don't know why you're saying that. The purpose of PyBuffer_Release is
>precisely to solve these kinds of use cases (where you want timely
>release of a resource rather than rely on the garbage collector).

Yes, I was unclear. This refers to Python 3.2, not the 2.x series. PyObject_AsReadBuffer (defined at line 270 in abstract.c, code of routine attached) calls bf_getbuffer with the PyBUF_SIMPLE flag to retrieve a bytes buffer. It then calls bf_releasebuffer before returning the buffer to the caller. PyObject_AsCharBuffer and PyObject_AsWriteBuffer do the same. It is not be exactly the same issue discussed so far, but is closely related.

Deprecating PyObject_AsReadBuffer is extreme, and doesn't solve the early release problem. Redefining the PyBUF_SIMPLE flag to be like the old buffer protocol warns those implementing a new buffer interface to  avoid processing PyBUF_SIMPLE requests when locking is required.
History
Date User Action Args
2010-09-28 16:45:59kermodesetrecipients: + kermode, lemburg, loewis, pitrou, vstinner
2010-09-28 16:45:59kermodesetmessageid: <1285692359.13.0.278085270749.issue9602@psf.upfronthosting.co.za>
2010-09-28 16:45:57kermodelinkissue9602 messages
2010-09-28 16:45:56kermodecreate