class documentation

class _ctypes:

View In Hierarchy

Undocumented

Method __init__ Undocumented
Method data​_as No summary
Method get​_as​_parameter Deprecated getter for the _ctypes._as_parameter_ property.
Method get​_data Deprecated getter for the _ctypes.data property.
Method get​_shape Deprecated getter for the _ctypes.shape property.
Method get​_strides Deprecated getter for the _ctypes.strides property.
Method shape​_as Return the shape tuple as an array of some other c-types type. For example: self.shape_as(ctypes.c_short).
Method strides​_as Return the strides tuple as an array of some other c-types type. For example: self.strides_as(ctypes.c_longlong).
Instance Variable ​_arr Undocumented
Instance Variable ​_ctypes Undocumented
Instance Variable ​_data Undocumented
Instance Variable ​_zerod Undocumented
Property ​_as​_parameter​_ Overrides the ctypes semi-magic method
Property data No summary
Property shape No summary
Property strides No summary
def __init__(self, array, ptr=None):

Undocumented

def data_as(self, obj):

Return the data pointer cast to a particular c-types object. For example, calling self._as_parameter_ is equivalent to self.data_as(ctypes.c_void_p). Perhaps you want to use the data as a pointer to a ctypes array of floating-point data: self.data_as(ctypes.POINTER(ctypes.c_double)).

The returned pointer will keep a reference to the array.

def get_as_parameter(self):

Deprecated getter for the _ctypes._as_parameter_ property.

Deprecated since version 1.21.
def get_data(self):

Deprecated getter for the _ctypes.data property.

Deprecated since version 1.21.
def get_shape(self):

Deprecated getter for the _ctypes.shape property.

Deprecated since version 1.21.
def get_strides(self):

Deprecated getter for the _ctypes.strides property.

Deprecated since version 1.21.
def shape_as(self, obj):
Return the shape tuple as an array of some other c-types type. For example: self.shape_as(ctypes.c_short).
def strides_as(self, obj):
Return the strides tuple as an array of some other c-types type. For example: self.strides_as(ctypes.c_longlong).
_arr =

Undocumented

_ctypes =

Undocumented

_data =

Undocumented

_zerod: bool =

Undocumented

@property
_as_parameter_ =

Overrides the ctypes semi-magic method

Enables c_func(some_array.ctypes)

@property
data =

A pointer to the memory area of the array as a Python integer. This memory area may contain data that is not aligned, or not in correct byte-order. The memory area may not even be writeable. The array flags and data-type of this array should be respected when passing this attribute to arbitrary C-code to avoid trouble that can include Python crashing. User Beware! The value of this attribute is exactly the same as self._array_interface_['data'][0].

Note that unlike data_as, a reference will not be kept to the array: code like ctypes.c_void_p((a + b).ctypes.data) will result in a pointer to a deallocated array, and should be spelt (a + b).ctypes.data_as(ctypes.c_void_p)

@property
shape =
(c_intp*self.ndim): A ctypes array of length self.ndim where the basetype is the C-integer corresponding to dtype('p') on this platform (see ~numpy.ctypeslib.c_intp). This base-type could be ctypes.c_int, ctypes.c_long, or ctypes.c_longlong depending on the platform. The ctypes array contains the shape of the underlying array.
@property
strides =
(c_intp*self.ndim): A ctypes array of length self.ndim where the basetype is the same as for the shape attribute. This ctypes array contains the strides information from the underlying array. This strides information is important for showing how many bytes must be jumped to get to the next element in the array.