@@ -12,7 +12,7 @@ The Array Interface
12
12
13
13
This page describes the numpy-specific API for accessing the contents of
14
14
a numpy array from other C extensions. :pep: `3118 ` --
15
- :cfunc : `The Revised Buffer Protocol <PyObject_GetBuffer> ` introduces
15
+ :c:func : `The Revised Buffer Protocol <PyObject_GetBuffer> ` introduces
16
16
similar, standardized API to Python 2.6 and 3.0 for any extension
17
17
module to use. Cython __'s buffer array support
18
18
uses the :pep: `3118 ` API; see the `Cython numpy
@@ -67,7 +67,7 @@ This approach to the interface consists of the object having an
67
67
could hold (a Python int is a C long). It is up to the code
68
68
using this attribute to handle this appropriately; either by
69
69
raising an error when overflow is possible, or by using
70
- :cdata : `Py_LONG_LONG ` as the C type for the shapes.
70
+ :c:data : `Py_LONG_LONG ` as the C type for the shapes.
71
71
72
72
**typestr ** (required)
73
73
@@ -88,9 +88,9 @@ This approach to the interface consists of the object having an
88
88
``u `` Unsigned integer
89
89
``f `` Floating point
90
90
``c `` Complex floating point
91
- ``O `` Object (i.e. the memory contains a pointer to :ctype : `PyObject `)
91
+ ``O `` Object (i.e. the memory contains a pointer to :c:type : `PyObject `)
92
92
``S `` String (fixed-length sequence of char)
93
- ``U `` Unicode (fixed-length sequence of :ctype : `Py_UNICODE `)
93
+ ``U `` Unicode (fixed-length sequence of :c:type : `Py_UNICODE `)
94
94
``V `` Other (void \* -- each item is a fixed-size chunk of memory)
95
95
===== ================================================================
96
96
@@ -134,7 +134,7 @@ This approach to the interface consists of the object having an
134
134
means the data area is read-only).
135
135
136
136
This attribute can also be an object exposing the
137
- :cfunc : `buffer interface <PyObject_AsCharBuffer> ` which
137
+ :c:func : `buffer interface <PyObject_AsCharBuffer> ` which
138
138
will be used to share the data. If this key is not present (or
139
139
returns :class: `None `), then memory sharing will be done
140
140
through the buffer interface of the object itself. In this
@@ -154,7 +154,7 @@ This approach to the interface consists of the object having an
154
154
:const: `int ` or :const: `long `). As with shape, the values may
155
155
be larger than can be represented by a C "int" or "long"; the
156
156
calling code should handle this appropiately, either by
157
- raising an error, or by using :ctype : `Py_LONG_LONG ` in C. The
157
+ raising an error, or by using :c:type : `Py_LONG_LONG ` in C. The
158
158
default is :const: `None ` which implies a C-style contiguous
159
159
memory buffer. In this model, the last dimension of the array
160
160
varies the fastest. For example, the default strides tuple
@@ -195,13 +195,13 @@ C-struct access
195
195
This approach to the array interface allows for faster access to an
196
196
array using only one attribute lookup and a well-defined C-structure.
197
197
198
- .. cvar :: __array_struct__
198
+ .. c : var :: __array_struct__
199
199
200
- A :ctype: `PyCObject ` whose :cdata : `voidptr ` member contains a
201
- pointer to a filled :ctype : `PyArrayInterface ` structure. Memory
202
- for the structure is dynamically created and the :ctype : `PyCObject `
200
+ A :c: type: `PyCObject ` whose :c:data : `voidptr ` member contains a
201
+ pointer to a filled :c:type : `PyArrayInterface ` structure. Memory
202
+ for the structure is dynamically created and the :c:type : `PyCObject `
203
203
is also created with an appropriate destructor so the retriever of
204
- this attribute simply has to apply :cfunc : `Py_DECREF() ` to the
204
+ this attribute simply has to apply :c:func : `Py_DECREF() ` to the
205
205
object returned by this attribute when it is finished. Also,
206
206
either the data needs to be copied out, or a reference to the
207
207
object exposing this attribute must be held to ensure the data is
@@ -239,12 +239,12 @@ flag is present.
239
239
.. admonition :: New since June 16, 2006:
240
240
241
241
In the past most implementations used the "desc" member of the
242
- :ctype : `PyCObject ` itself (do not confuse this with the "descr" member of
243
- the :ctype : `PyArrayInterface ` structure above --- they are two separate
242
+ :c:type : `PyCObject ` itself (do not confuse this with the "descr" member of
243
+ the :c:type : `PyArrayInterface ` structure above --- they are two separate
244
244
things) to hold the pointer to the object exposing the interface.
245
245
This is now an explicit part of the interface. Be sure to own a
246
- reference to the object when the :ctype : `PyCObject ` is created using
247
- :ctype : `PyCObject_FromVoidPtrAndDesc `.
246
+ reference to the object when the :c:type : `PyCObject ` is created using
247
+ :c:type : `PyCObject_FromVoidPtrAndDesc `.
248
248
249
249
250
250
Type description examples
0 commit comments