Skip to content

Fix C API docs: PyCapsule_Import always set an exception on failure. #6967

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 18, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions Doc/c-api/capsule.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ Capsules

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

.. versionadded:: 3.1


.. c:type:: PyCapsule

Expand All @@ -19,6 +21,7 @@ Refer to :ref:`using-capsules` for more information on using these objects.
regular import mechanism can be used to access C APIs defined in dynamically
loaded modules.


.. c:type:: PyCapsule_Destructor

The type of a destructor callback for a capsule. Defined as::
Expand Down Expand Up @@ -104,8 +107,8 @@ Refer to :ref:`using-capsules` for more information on using these objects.
import the module conventionally (using :c:func:`PyImport_ImportModule`).

Return the capsule's internal *pointer* on success. On failure, set an
exception and return *NULL*. However, if :c:func:`PyCapsule_Import` failed to
import the module, and *no_block* was true, no exception is set.
exception and return *NULL*.


.. c:function:: int PyCapsule_IsValid(PyObject *capsule, const char *name)

Expand All @@ -122,18 +125,21 @@ Refer to :ref:`using-capsules` for more information on using these objects.
Return a nonzero value if the object is valid and matches the name passed in.
Return ``0`` otherwise. This function will not fail.


.. c:function:: int PyCapsule_SetContext(PyObject *capsule, void *context)

Set the context pointer inside *capsule* to *context*.

Return ``0`` on success. Return nonzero and set an exception on failure.


.. c:function:: int PyCapsule_SetDestructor(PyObject *capsule, PyCapsule_Destructor destructor)

Set the destructor inside *capsule* to *destructor*.

Return ``0`` on success. Return nonzero and set an exception on failure.


.. c:function:: int PyCapsule_SetName(PyObject *capsule, const char *name)

Set the name inside *capsule* to *name*. If non-*NULL*, the name must
Expand All @@ -142,6 +148,7 @@ Refer to :ref:`using-capsules` for more information on using these objects.

Return ``0`` on success. Return nonzero and set an exception on failure.


.. c:function:: int PyCapsule_SetPointer(PyObject *capsule, void *pointer)

Set the void pointer inside *capsule* to *pointer*. The pointer may not be
Expand Down