[Python-3000] PEP Draft: Enhancing the buffer protcol

Travis E. Oliphant oliphant.travis at ieee.org
Wed Feb 28 06:00:19 CET 2007

Travis E. Oliphant wrote:
> The memory management is the only issue.

In fact, the PEP still has the issue of who manages the memory for the 
format-description string when it is returned.

The easiest thing to do is to return a Python String and let reference 
counting handle the memory management.

What if we were also to return from the shape call a Python C-Object 
that loosely wrapped the shape and strides c-arrays.  Then, it would 
free the memory on deallocation.

A C-API call that created such a C-Object from two arrays of integers 
could be provided to make it easy.


More information about the Python-3000 mailing list