Skip to content

Commit bde3e0b

Browse files
Fix C API docs: PyCapsule_Import always set an exception on failure. (GH-6967)
1 parent d89ca94 commit bde3e0b

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

Doc/c-api/capsule.rst

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ Capsules
99

1010
Refer to :ref:`using-capsules` for more information on using these objects.
1111

12+
.. versionadded:: 3.1
13+
1214

1315
.. c:type:: PyCapsule
1416
@@ -19,6 +21,7 @@ Refer to :ref:`using-capsules` for more information on using these objects.
1921
regular import mechanism can be used to access C APIs defined in dynamically
2022
loaded modules.
2123

24+
2225
.. c:type:: PyCapsule_Destructor
2326
2427
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.
104107
import the module conventionally (using :c:func:`PyImport_ImportModule`).
105108
106109
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+
109112
110113
.. c:function:: int PyCapsule_IsValid(PyObject *capsule, const char *name)
111114
@@ -122,18 +125,21 @@ Refer to :ref:`using-capsules` for more information on using these objects.
122125
Return a nonzero value if the object is valid and matches the name passed in.
123126
Return ``0`` otherwise. This function will not fail.
124127
128+
125129
.. c:function:: int PyCapsule_SetContext(PyObject *capsule, void *context)
126130
127131
Set the context pointer inside *capsule* to *context*.
128132
129133
Return ``0`` on success. Return nonzero and set an exception on failure.
130134
135+
131136
.. c:function:: int PyCapsule_SetDestructor(PyObject *capsule, PyCapsule_Destructor destructor)
132137
133138
Set the destructor inside *capsule* to *destructor*.
134139
135140
Return ``0`` on success. Return nonzero and set an exception on failure.
136141
142+
137143
.. c:function:: int PyCapsule_SetName(PyObject *capsule, const char *name)
138144
139145
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.
142148
143149
Return ``0`` on success. Return nonzero and set an exception on failure.
144150
151+
145152
.. c:function:: int PyCapsule_SetPointer(PyObject *capsule, void *pointer)
146153
147154
Set the void pointer inside *capsule* to *pointer*. The pointer may not be

0 commit comments

Comments
 (0)