Skip to content

Commit 29d1c16

Browse files
committed
cosmetics
1 parent 7e3b66f commit 29d1c16

File tree

2 files changed

+30
-31
lines changed

2 files changed

+30
-31
lines changed

Doc/extending/extending.rst

Lines changed: 29 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -77,33 +77,35 @@ the module and a copyright notice if you like).
7777
All user-visible symbols defined by :file:`Python.h` have a prefix of ``Py`` or
7878
``PY``, except those defined in standard header files.
7979

80-
For backward compatibility, :file:`Python.h` includes several standard header files.
81-
C extensions should include the standard headers that they use, and should not rely
82-
on these implicit includes.
83-
If using the limited C API version 3.13 or newer, the implicit includes are:
84-
85-
* ``<assert.h>``
86-
* ``<intrin.h>`` (on Windows)
87-
* ``<inttypes.h>``
88-
* ``<limits.h>``
89-
* ``<math.h>``
90-
* ``<stdarg.h>``
91-
* ``<wchar.h>``
92-
* ``<sys/types.h>`` (if present)
93-
94-
If :c:macro:`Py_LIMITED_API` is not defined, or is set to version 3.12 or older,
95-
the headers below are also included:
96-
97-
* ``<ctype.h>``
98-
* ``<unistd.h>`` (on POSIX)
99-
100-
If :c:macro:`Py_LIMITED_API` is not defined, or is set to version 3.10 or older,
101-
the headers below are also included:
102-
103-
* ``<errno.h>``
104-
* ``<stdio.h>``
105-
* ``<stdlib.h>``
106-
* ``<string.h>``
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>``
107109

108110
The next thing we add to our module file is the C function that will be called
109111
when the Python expression ``spam.system(string)`` is evaluated (we'll see

Include/Python.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@
22
// C extensions should only #include <Python.h>, and not include directly
33
// the other Python header files included by <Python.h>.
44

5-
// Note: If the included standard headers change, please update the documentation
6-
// (including the documentation for C extensions) accordingly.
7-
8-
95
#ifndef Py_PYTHON_H
106
#define Py_PYTHON_H
117

@@ -20,6 +16,7 @@
2016

2117

2218
// Include standard header files
19+
// When changing these files, remember to update Doc/extending/extending.rst.
2320
#include <assert.h> // assert()
2421
#include <inttypes.h> // uintptr_t
2522
#include <limits.h> // INT_MAX

0 commit comments

Comments
 (0)