[New-bugs-announce] [issue27274] [ctypes] Allow from_pointer creation

Memeplex report at bugs.python.org
Wed Jun 8 23:17:38 EDT 2016

New submission from Memeplex:

This real life example is pretty terrible:

(ct.c_float * self._nfeats).from_address(

The alternative of casting the pointer to pointer-to-array, then pick ptr.contents is not really better.

What about a from_pointer(ptr) method? Or overloading from_address to take a pointer? Or a simple shortcut to get the address pointed to by a pointer (related: https://bugs.python.org/issue26565).

I think this part of ctypes api needs to get more concise and pythonic.

components: ctypes
messages: 267951
nosy: memeplex
priority: normal
severity: normal
status: open
title: [ctypes] Allow from_pointer creation
type: enhancement

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list