9
9
10
10
Refer to :ref: `using-capsules ` for more information on using these objects.
11
11
12
+ .. versionadded :: 3.1
13
+
12
14
13
15
.. c :type :: PyCapsule
14
16
@@ -19,6 +21,7 @@ Refer to :ref:`using-capsules` for more information on using these objects.
19
21
regular import mechanism can be used to access C APIs defined in dynamically
20
22
loaded modules.
21
23
24
+
22
25
.. c :type :: PyCapsule_Destructor
23
26
24
27
The type of a destructor callback for a capsule. Defined as::
@@ -104,8 +107,8 @@ Refer to :ref:`using-capsules` for more information on using these objects.
104
107
import the module conventionally (using :c:func: `PyImport_ImportModule `).
105
108
106
109
Return the capsule's internal *pointer* on success. On failure, set an
107
- exception and return *NULL*. However, if :c:func:`PyCapsule_Import` failed to
108
- import the module, and *no_block* was true, no exception is set.
110
+ exception and return *NULL*.
111
+
109
112
110
113
.. c:function:: int PyCapsule_IsValid(PyObject *capsule, const char *name)
111
114
@@ -122,18 +125,21 @@ Refer to :ref:`using-capsules` for more information on using these objects.
122
125
Return a nonzero value if the object is valid and matches the name passed in.
123
126
Return ``0`` otherwise. This function will not fail.
124
127
128
+
125
129
.. c:function:: int PyCapsule_SetContext(PyObject *capsule, void *context)
126
130
127
131
Set the context pointer inside *capsule * to *context *.
128
132
129
133
Return ``0 `` on success. Return nonzero and set an exception on failure.
130
134
135
+
131
136
.. c :function :: int PyCapsule_SetDestructor (PyObject *capsule, PyCapsule_Destructor destructor)
132
137
133
138
Set the destructor inside *capsule * to *destructor *.
134
139
135
140
Return ``0 `` on success. Return nonzero and set an exception on failure.
136
141
142
+
137
143
.. c :function :: int PyCapsule_SetName (PyObject *capsule, const char *name)
138
144
139
145
Set the name inside *capsule * to *name *. If non-*NULL *, the name must
@@ -142,6 +148,7 @@ Refer to :ref:`using-capsules` for more information on using these objects.
142
148
143
149
Return ``0 `` on success. Return nonzero and set an exception on failure.
144
150
151
+
145
152
.. c :function :: int PyCapsule_SetPointer (PyObject *capsule, void *pointer)
146
153
147
154
Set the void pointer inside *capsule * to *pointer *. The pointer may not be
0 commit comments