This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Create ctypes instances from buffer interface
Type: behavior Stage:
Components: ctypes Versions: Python 2.6
process
Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: theller Nosy List: theller
Priority: normal Keywords: patch

Created on 2008-04-18 18:31 by theller, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (3)
msg65620 - (view) Author: Thomas Heller (theller) * (Python committer) Date: 2008-04-18 18:30
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.

Open question:
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)?
msg65736 - (view) Author: Thomas Heller (theller) * (Python committer) Date: 2008-04-24 18:21
The suggestion by Lenard Lindstrom was an additional method named
'from_buffer_copy'.
msg65787 - (view) Author: Thomas Heller (theller) * (Python committer) Date: 2008-04-25 15:46
Implemented from_buffer() and from_buffer_copy() as rev 62497 to SVN trunk.
History
Date User Action Args
2022-04-11 14:56:33adminsetgithub: 46907
2008-04-25 15:46:11thellersetfiles: - from_buffer.patch
2008-04-25 15:46:04thellersetstatus: open -> closed
keywords: patch, patch
resolution: accepted
messages: + msg65787
2008-04-24 18:21:48thellersetkeywords: patch, patch
messages: + msg65736
2008-04-18 18:31:14thellersetkeywords: patch, patch
type: behavior
2008-04-18 18:31:03thellercreate