[issue9602] PyObject_AsCharBuffer() should only accept read-only objects

2010-09-28 Thread Lenard Lindstrom
Lenard Lindstrom added the comment: That is perfectly fine with me. -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubs

[issue9602] PyObject_AsCharBuffer() should only accept read-only objects

2010-09-28 Thread Antoine Pitrou
Antoine Pitrou added the comment: Ok, 3.x documentation is fixed to recommend the new buffer API funcs over the old compatibility funcs. On Victor's private suggestion, I'm now closing the issue. -- resolution: -> wont fix status: open -> closed _

[issue9602] PyObject_AsCharBuffer() should only accept read-only objects

2010-09-28 Thread Antoine Pitrou
Antoine Pitrou added the comment: > Le mardi 28 septembre 2010 22:24:56, vous avez écrit : > > 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

[issue9602] PyObject_AsCharBuffer() should only accept read-only objects

2010-09-28 Thread STINNER Victor
STINNER Victor added the comment: Le mardi 28 septembre 2010 22:24:56, vous avez écrit : > 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 > PyObj

[issue9602] PyObject_AsCharBuffer() should only accept read-only objects

2010-09-28 Thread Antoine Pitrou
Antoine Pitrou added the comment: > 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_releasebuffe

[issue9602] PyObject_AsCharBuffer() should only accept read-only objects

2010-09-28 Thread Lenard Lindstrom
Lenard Lindstrom added the comment: >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

[issue9602] PyObject_AsCharBuffer() should only accept read-only objects

2010-09-28 Thread Antoine Pitrou
Antoine Pitrou added the comment: Le mardi 28 septembre 2010 à 03:11 +, Lenard Lindstrom a écrit : > > Let's consider Pygame, and the SDL surface it wraps as a > pygame.Surface. Pygame exposes a surface's data through the buffer > protocol for manipulation by a NumPy array. Now some SDL sur

[issue9602] PyObject_AsCharBuffer() should only accept read-only objects

2010-09-27 Thread Lenard Lindstrom
Lenard Lindstrom added the comment: PEP 3118 """ Rationale ... 3) There is no way for a consumer to tell the buffer-API-exporting object it is "finished" with its view of the memory and therefore no way for the exporting object to be sure that it is safe to reallocate the pointer to the mem

[issue9602] PyObject_AsCharBuffer() should only accept read-only objects

2010-08-20 Thread Terry J. Reedy
Changes by Terry J. Reedy : -- versions: -Python 2.7 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mai

[issue9602] PyObject_AsCharBuffer() should only accept read-only objects

2010-08-17 Thread Marc-Andre Lemburg
Marc-Andre Lemburg added the comment: STINNER Victor wrote: > > STINNER Victor added the comment: > >> Note that the buffer interface release API is meant to protect >> against such modifications, so I don't see why rejecting objects >> that do implement this API should be rejected. > > As I

[issue9602] PyObject_AsCharBuffer() should only accept read-only objects

2010-08-16 Thread STINNER Victor
STINNER Victor added the comment: > Note that the buffer interface release API is meant to protect > against such modifications, so I don't see why rejecting objects > that do implement this API should be rejected. As I explained, the release API is *not* used by PyObject_AsCharBuffer() in Pyt

[issue9602] PyObject_AsCharBuffer() should only accept read-only objects

2010-08-16 Thread Marc-Andre Lemburg
Marc-Andre Lemburg added the comment: STINNER Victor wrote: > > New submission from STINNER Victor : > > mmap, buffer, bytearray, string and unicode objects set the char buffer > callback (bf_getcharbuffer). The bytearray object sets also the release > buffer callback (bf_releasebuffer). >

[issue9602] PyObject_AsCharBuffer() should only accept read-only objects

2010-08-14 Thread Antoine Pitrou
Antoine Pitrou added the comment: I don't think we should change anything in 2.7 at this point. It risks breaking compatibility while we are at the end of the 2.x line, for little added benefit (the old buffer API has always been insecure with mutable buffers). As for 3.2, PyObject_AsCharBuff

[issue9602] PyObject_AsCharBuffer() should only accept read-only objects

2010-08-14 Thread STINNER Victor
New submission from STINNER Victor : mmap, buffer, bytearray, string and unicode objects set the char buffer callback (bf_getcharbuffer). The bytearray object sets also the release buffer callback (bf_releasebuffer). In Python 2.7, PyObject_AsCharBuffer() accepts bytearray objects, whereas the