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 pitrou
Recipients kermode, lemburg, loewis, pitrou, vstinner
Date 2010-09-28.20:24:54
SpamBayes Score 5.9588587e-08
Marked as misclassified No
Message-id <1285705490.3183.1.camel@localhost.localdomain>
In-reply-to <1285692359.13.0.278085270749.issue9602@psf.upfronthosting.co.za>
Content
> 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,

I disagree. PyObject_As*Buffer functions are remnants of the old buffer
API in Python 2.x. They are here only to ease porting of existing C
code, but carefully written 3.x code should switch to
PyObject_GetBuffer() (or one of the dedicated typecodes in
PyArg_ParseTuple: "y*", "w*", etc.).

> 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.

Well, the new buffer API was designed precisely because the old API
wasn't appropriate, so your proposal to revive the old API doesn't sound
very compelling, to say the least.

To restate things a bit more clearly: you should use
PyObject_GetBuffer(), not any of the PyObject_As*Buffer functions.
Perhaps you should explain why you care about the latter rather than the
former.
History
Date User Action Args
2010-09-28 20:24:56pitrousetrecipients: + pitrou, lemburg, loewis, kermode, vstinner
2010-09-28 20:24:54pitroulinkissue9602 messages
2010-09-28 20:24:54pitroucreate