Skip to content

Commit 3cd04fc

Browse files
committed
pythongh-76595: Add note on PyCapsule_Import behavior
There's a PR (pythonGH-6898) which changes this behavior (to be less surprising, I believe), but this seems to have stalled. See: python#76595 See: python#6898
1 parent e123a1d commit 3cd04fc

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

Doc/c-api/capsule.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,14 @@ Refer to :ref:`using-capsules` for more information on using these objects.
108108
Return the capsule's internal *pointer* on success. On failure, set an
109109
exception and return ``NULL``.
110110
111+
.. note::
112+
113+
:c:func:`PyCapsule_Import` splits *name* on the ``.`` character, and
114+
imports the first element. It then processes further elements using
115+
attribute lookups. As a result, if *name* points to an attribute in
116+
some submodule or subpackage, this submodule or subpackage must be
117+
previously imported using other means (e.g. by using :c:func:`PyImport_ImportModule`).
118+
111119
.. versionchanged:: 3.3
112120
*no_block* has no effect anymore.
113121

0 commit comments

Comments
 (0)