@@ -75,12 +75,37 @@ the module and a copyright notice if you like).
75
75
See :ref: `arg-parsing-string-and-buffers ` for a description of this macro.
76
76
77
77
All user-visible symbols defined by :file: `Python.h ` have a prefix of ``Py `` or
78
- ``PY ``, except those defined in standard header files. For convenience, and
79
- since they are used extensively by the Python interpreter, ``"Python.h" ``
80
- includes a few standard header files: ``<stdio.h> ``, ``<string.h> ``,
81
- ``<errno.h> ``, and ``<stdlib.h> ``. If the latter header file does not exist on
82
- your system, it declares the functions :c:func: `malloc `, :c:func: `free ` and
83
- :c:func: `realloc ` directly.
78
+ ``PY ``, except those defined in standard header files.
79
+
80
+ .. tip ::
81
+
82
+ For backward compatibility, :file: `Python.h ` includes several standard header files.
83
+ C extensions should include the standard headers that they use,
84
+ and should not rely on these implicit includes.
85
+ If using the limited C API version 3.13 or newer, the implicit includes are:
86
+
87
+ * ``<assert.h> ``
88
+ * ``<intrin.h> `` (on Windows)
89
+ * ``<inttypes.h> ``
90
+ * ``<limits.h> ``
91
+ * ``<math.h> ``
92
+ * ``<stdarg.h> ``
93
+ * ``<wchar.h> ``
94
+ * ``<sys/types.h> `` (if present)
95
+
96
+ If :c:macro: `Py_LIMITED_API ` is not defined, or is set to version 3.12 or older,
97
+ the headers below are also included:
98
+
99
+ * ``<ctype.h> ``
100
+ * ``<unistd.h> `` (on POSIX)
101
+
102
+ If :c:macro: `Py_LIMITED_API ` is not defined, or is set to version 3.10 or older,
103
+ the headers below are also included:
104
+
105
+ * ``<errno.h> ``
106
+ * ``<stdio.h> ``
107
+ * ``<stdlib.h> ``
108
+ * ``<string.h> ``
84
109
85
110
The next thing we add to our module file is the C function that will be called
86
111
when the Python expression ``spam.system(string) `` is evaluated (we'll see
0 commit comments