]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-76595: Add note on `PyCapsule_Import` behavior (GH-134022)
authorNicolas Trangez <ikke@nicolast.be>
Sat, 28 Jun 2025 13:01:41 +0000 (15:01 +0200)
committerGitHub <noreply@github.com>
Sat, 28 Jun 2025 13:01:41 +0000 (09:01 -0400)
Doc/c-api/capsule.rst

index cdb8aa33e9fd325585e99ec6bdebcc6e09dc2fe0..64dc4f5275b512cfd041df7c663118fabf3e040a 100644 (file)
@@ -105,9 +105,19 @@ Refer to :ref:`using-capsules` for more information on using these objects.
    ``module.attribute``.  The *name* stored in the capsule must match this
    string exactly.
 
+   This function splits *name* on the ``.`` character, and imports the first
+   element. It then processes further elements using attribute lookups.
+
    Return the capsule's internal *pointer* on success.  On failure, set an
    exception and return ``NULL``.
 
+   .. note::
+
+      If *name* points to an attribute of some submodule or subpackage, this
+      submodule or subpackage must be previously imported using other means
+      (for example, by using :c:func:`PyImport_ImportModule`) for the
+      attribute lookups to succeed.
+
    .. versionchanged:: 3.3
       *no_block* has no effect anymore.