[docs] [issue15821] Improve docs for PyMemoryView_FromBuffer()
Stefan Krah
report at bugs.python.org
Thu Aug 30 15:39:04 CEST 2012
Stefan Krah added the comment:
This may be a bigger problem (grep for image_surface_get_data):
http://lists.cairographics.org/archives/cairo/2011-December/022563.html
The previous semantics for PyMemoryView_FromBuffer(view) were:
1) If non-NULL, steal the view.obj reference with automatic
decrement in PyBuffer_Release().
2) Copy shape and strides to view.smalltable.
The new semantics for PyMemoryView_FromBuffer(view) are:
1) If non-NULL, treat view.obj as a borrowed reference.
2) Rely on the fact that shape and strides won't disappear.
2) means that returning PyMemoryView_FromBuffer(view) from
a view allocated on the stack is no longer safe. In all instances
people could migrate to PyMemoryView_FromMemory(), which is
both safe and more convenient, but code may be broken.
PyManaged_Buffer is designed to expect buffers from exporters,
where it is guaranteed that the buffers won't disappear,so it
won't be easy to keep backwards compatibility.
----------
priority: normal -> high
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue15821>
_______________________________________
More information about the docs
mailing list