Skip to content

Commit 1c9a991

Browse files
committed
pythongh-107298: Document PyAPI_DATA() macro
Document PyAPI_DATA(), and PyAPI_FUNC() and PyMODINIT_FUNC macros in Doc/c-api/intro.rst. This change fix Sphinx warnings in Doc/using/configure.rst.
1 parent 00cf626 commit 1c9a991

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

Doc/c-api/intro.rst

+22
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,28 @@ defined closer to where they are useful (e.g. :c:macro:`Py_RETURN_NONE`).
105105
Others of a more general utility are defined here. This is not necessarily a
106106
complete listing.
107107

108+
.. c:macro:: PyAPI_DATA(type)
109+
110+
Declare a variable of type *type* which should be exported by Python. The
111+
macro should only be used in Python C API. Example::
112+
113+
PyAPI_DATA(const unsigned long) Py_Version;
114+
115+
.. c:macro:: PyAPI_FUNC(type)
116+
117+
Declare a function with a return type *type* which should be exported by
118+
Python. The macro should only be used in Python C API. Example::
119+
120+
PyAPI_FUNC(PyObject *) PyLong_FromLong(long);
121+
122+
.. c:macro:: PyMODINIT_FUNC
123+
124+
Declare an extension module ``PyInit`` initialization function. The return
125+
type is :c:expr:`PyObject*`. The macro should only be used in Python C API.
126+
Example with the ``_ssl`` module::
127+
128+
PyMODINIT_FUNC PyInit__ssl(void)
129+
108130
.. c:macro:: Py_ABS(x)
109131
110132
Return the absolute value of ``x``.

0 commit comments

Comments
 (0)