[issue2655] Create ctypes instances from buffer interface
report at bugs.python.org
Fri Apr 18 20:31:04 CEST 2008
New submission from Thomas Heller <theller at ctypes.org>:
This patch implements a .from_buffer(source, offset=0) class method from
ctypes types. 'source' must expose a writeable buffer interface; the
created ctypes instance will share the internal buffer of the source
object; also it holds a reference to the source object to keep it alive.
The usual problems with the buffer interface are not hidden.
Should there be an additional 'copy_from_buffer' class method that
accepts read-only buffer interface (as an alternative, an optional
'copy=False' parameter could be introduced)?
keywords: patch, patch
title: Create ctypes instances from buffer interface
versions: Python 2.6
Added file: http://bugs.python.org/file10057/from_buffer.patch
Tracker <report at bugs.python.org>
More information about the Python-bugs-list