On 11/1/06, "Martin v. Löwis" <martin v.loewis.de> wrote:
> That's also an interesting issue for the datatypes PEP:
are datatype
> objects meant to be immutable?
>
That's a question for Travis, but I would think that they
would be
immutable at the Python level, but mutable at the C level.
In Travis'
approach array size is not stored in the datatype, so I
don't see
much need to modify datatype objects in-place. It may be
reasonable to
allow adding fields to a record, but I don't have enough
experience
with that to comment.
> This is particularly interesting for the extended
buffer protocol:
> how long can one keep the data you get from
bt_getarrayinfo?
>
I think your question is limited to shape and strides
outputs because
dataformat is a reference counted PyObject (and PEP should
specify
whether it is a borrowed reference).
And the answer is the same as for the data from
bf_getreadbuffer/bf_getwritebuffer . AFAIK, existing buffer
protocol
does not answer this question delegating it to the extension
module
writers who provide objects exporting their buffers.
> Also, how does the memory management work for the
results?
I think it is implied that all pointers are borrowed
references. I
could not find any discussion of memory management in the
current
buffer protocol documentation.
This is a good question. It may be the case that the shape
or stride
information is not available as Py_intptr_t array inside the
object
that wants to export its memory buffer. This is not
theoretical, I
have a 64-bit application that uses objects that keep their
size
information in a 32-bit int.
BTW, I think the memory management issues with the buffer
objects have
been resolved at some point. Any lessons to learn from
that?
_______________________________________________
Python-Dev mailing list
Python-Dev python.org
ht
tp://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/p
ython-dev/nessto%40sharedlog.com
|