Antoine Pitrou pit...@free.fr 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
Lenard Lindstrom le...@telus.net 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
Antoine Pitrou pit...@free.fr 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
STINNER Victor victor.stin...@haypocalc.com 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
Antoine Pitrou pit...@free.fr 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
Antoine Pitrou pit...@free.fr 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
Lenard Lindstrom le...@telus.net added the comment:
That is perfectly fine with me.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9602
___
___
Lenard Lindstrom le...@telus.net 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
Changes by Terry J. Reedy tjre...@udel.edu:
--
versions: -Python 2.7
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9602
___
___
Python-bugs-list
Marc-Andre Lemburg m...@egenix.com added the comment:
STINNER Victor wrote:
STINNER Victor victor.stin...@haypocalc.com 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
Marc-Andre Lemburg m...@egenix.com added the comment:
STINNER Victor wrote:
New submission from STINNER Victor victor.stin...@haypocalc.com:
mmap, buffer, bytearray, string and unicode objects set the char buffer
callback (bf_getcharbuffer). The bytearray object sets also the release
STINNER Victor victor.stin...@haypocalc.com 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
New submission from STINNER Victor victor.stin...@haypocalc.com:
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
Antoine Pitrou pit...@free.fr 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,
14 matches
Mail list logo