[issue9990] PyMemoryView_FromObject alters the Py_buffer after calling PyObject_GetBuffer when ndim 1

Antoine Pitrou report at bugs.python.org
Wed Dec 22 14:11:54 CET 2010


Antoine Pitrou <pitrou at free.fr> added the comment:

> (1) Is there documentation for the 'smalltable' field of the Py_buffer
> struct anywhere?  What are the requirements for the exporter here?

No, and no particular requirements AFAIR. It is a piece of internal
storage aimed at avoiding the nagging allocation and ownership problem
(but only so when this storage is large enough, of course).

> E.g., is it / should it be a requirement that shape, strides and
> suboffsets are all NULL whenever 'smalltable' is used?

Not at all. On the contrary, smalltable can be used as a piece of
storage for some of these fields.

> (2) Same question for the 'obj' field:  what's the purpose of this
> field, from the POV of 3rd party buffer exporters?

None, it's used by the consumer side of the API, to know which object
exported the buffer and to keep a reference to it so that it doesn't get
deallocated early.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue9990>
_______________________________________


More information about the Python-bugs-list mailing list