diff options
author | Adam Turner <9087854+AA-Turner@users.noreply.github.com> | 2022-10-05 18:01:14 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-05 18:01:14 (GMT) |
commit | 0031e62973801d34a9e19ab7bb199e9668e32d7b (patch) | |
tree | 631d5d18493647b9f0e5856aeeba06740917a1a7 /Doc/extending/extending.rst | |
parent | aeb28f51304ebe2ad9fd6a61b6e4e5a03d288aa1 (diff) | |
download | cpython-0031e62973801d34a9e19ab7bb199e9668e32d7b.zip cpython-0031e62973801d34a9e19ab7bb199e9668e32d7b.tar.gz cpython-0031e62973801d34a9e19ab7bb199e9668e32d7b.tar.bz2 |
gh-93738: Documentation C syntax (:c:type:<C type> -> :c:expr:<C type>) (#97768)
:c:type:`<C type>` -> :c:expr:`<C type>`
Co-authored-by: Ćukasz Langa <lukasz@langa.pl>
Diffstat (limited to 'Doc/extending/extending.rst')
-rw-r--r-- | Doc/extending/extending.rst | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Doc/extending/extending.rst b/Doc/extending/extending.rst index 0ef899f..d9bf4fd 100644 --- a/Doc/extending/extending.rst +++ b/Doc/extending/extending.rst @@ -298,7 +298,7 @@ In this case, it will return an integer object. (Yes, even integers are objects on the heap in Python!) If you have a C function that returns no useful argument (a function returning -:c:type:`void`), the corresponding Python function must return ``None``. You +:c:expr:`void`), the corresponding Python function must return ``None``. You need this idiom to do so (which is implemented by the :c:macro:`Py_RETURN_NONE` macro):: @@ -1171,7 +1171,7 @@ other extension modules must be exported in a different way. Python provides a special mechanism to pass C-level information (pointers) from one extension module to another one: Capsules. A Capsule is a Python data type -which stores a pointer (:c:type:`void \*`). Capsules can only be created and +which stores a pointer (:c:expr:`void \*`). Capsules can only be created and accessed via their C API, but they can be passed around like any other Python object. In particular, they can be assigned to a name in an extension module's namespace. Other extension modules can then import this module, retrieve the @@ -1185,7 +1185,7 @@ different ways between the module providing the code and the client modules. Whichever method you choose, it's important to name your Capsules properly. The function :c:func:`PyCapsule_New` takes a name parameter -(:c:type:`const char \*`); you're permitted to pass in a ``NULL`` name, but +(:c:expr:`const char \*`); you're permitted to pass in a ``NULL`` name, but we strongly encourage you to specify a name. Properly named Capsules provide a degree of runtime type-safety; there is no feasible way to tell one unnamed Capsule from another. @@ -1203,7 +1203,7 @@ of certainty that the Capsule they load contains the correct C API. The following example demonstrates an approach that puts most of the burden on the writer of the exporting module, which is appropriate for commonly used library modules. It stores all C API pointers (just one in the example!) in an -array of :c:type:`void` pointers which becomes the value of a Capsule. The header +array of :c:expr:`void` pointers which becomes the value of a Capsule. The header file corresponding to the module provides a macro that takes care of importing the module and retrieving its C API pointers; client modules only have to call this macro before accessing the C API. |