[Python-Dev] Py_Buffer and pep3118

Antoine Pitrou solipsis at pitrou.net
Fri Jul 9 15:17:36 CEST 2010

On Fri, 9 Jul 2010 08:38:53 +0000
Kristján Valur Jónsson <kristjan at ccpgames.com> wrote:
> In short, what the documentation fails to mention (and the pep) is whether posessing a
> locked Py_Buffer structure also constitutes holding a reference to the exporting object?

It does.

>  I think it does, but is this guaranteed to be so?

Now that's a good question. This was changed so that every producer of
tp_buffer doesn't have to do it by itself. In any case, acquiring the
buffer means it will be valid until it is released, which is what
you should primarily care about.

> Also, is the PyBuffer_Release() guaranteed to be "safe" to call
> multiple times (as the current implementation is)?

It's not, but we could make it so.



More information about the Python-Dev mailing list