]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-108216: Cleanup #include in internal header files (#108228)
authorVictor Stinner <vstinner@python.org>
Mon, 21 Aug 2023 18:05:59 +0000 (20:05 +0200)
committerGitHub <noreply@github.com>
Mon, 21 Aug 2023 18:05:59 +0000 (18:05 +0000)
* Add missing includes.
* Remove unused includes.
* Update old include/symbol names to newer names.
* Mention at least one included symbol.
* Sort includes.
* Update Tools/cases_generator/generate_cases.py used to generated
  pycore_opcode_metadata.h.
* Update Parser/asdl_c.py used to generate pycore_ast.h.
* Cleanup also includes in _testcapimodule.c and _testinternalcapi.c.

32 files changed:
Include/internal/pycore_ast.h
Include/internal/pycore_atomic.h
Include/internal/pycore_bitutils.h
Include/internal/pycore_ceval.h
Include/internal/pycore_ceval_state.h
Include/internal/pycore_condvar.h
Include/internal/pycore_context.h
Include/internal/pycore_dict.h
Include/internal/pycore_faulthandler.h
Include/internal/pycore_fileutils.h
Include/internal/pycore_gil.h
Include/internal/pycore_global_objects.h
Include/internal/pycore_import.h
Include/internal/pycore_instruments.h
Include/internal/pycore_interp.h
Include/internal/pycore_object.h
Include/internal/pycore_opcode_metadata.h
Include/internal/pycore_opcode_utils.h
Include/internal/pycore_optimizer.h
Include/internal/pycore_pymem_init.h
Include/internal/pycore_pystate.h
Include/internal/pycore_pythread.h
Include/internal/pycore_runtime.h
Include/internal/pycore_runtime_init.h
Include/internal/pycore_runtime_init_generated.h
Include/internal/pycore_signal.h
Include/internal/pycore_typeobject.h
Modules/_json.c
Modules/_testcapimodule.c
Modules/_testinternalcapi.c
Parser/asdl_c.py
Tools/cases_generator/generate_cases.py

index b568902bb1e38182d830ddbb569adcfd4587774c..f222d485e0b54b9bc947404343e4f7c202c98191 100644 (file)
@@ -10,7 +10,7 @@ extern "C" {
 #  error "this header requires Py_BUILD_CORE define"
 #endif
 
-#include "pycore_asdl.h"
+#include "pycore_asdl.h"          // _ASDL_SEQ_HEAD
 
 typedef struct _mod *mod_ty;
 
index 425d69f868b52b26ad34bbf724ad7671012404d0..48d246ea08f3d98cf2adf2dcc0a7bb23ff4f332a 100644 (file)
@@ -8,19 +8,19 @@ extern "C" {
 #  error "this header requires Py_BUILD_CORE define"
 #endif
 
-#include "dynamic_annotations.h"   /* _Py_ANNOTATE_MEMORY_ORDER */
-#include "pyconfig.h"
+#include "pyconfig.h"             // HAVE_STD_ATOMIC
+#include "dynamic_annotations.h"  // _Py_ANNOTATE_MEMORY_ORDER
 
 #ifdef HAVE_STD_ATOMIC
-#  include <stdatomic.h>
+#  include <stdatomic.h>          // atomic_store_explicit()
 #endif
 
 
 #if defined(_MSC_VER)
-#include <intrin.h>
-#if defined(_M_IX86) || defined(_M_X64)
-#  include <immintrin.h>
-#endif
+#  include <intrin.h>             // _InterlockedExchange64()
+#  if defined(_M_IX86) || defined(_M_X64)
+#    include <immintrin.h>        // _InterlockedExchange_HLEAcquire()
+#  endif
 #endif
 
 /* This is modeled after the atomics interface from C1x, according to
index e6bf61ef425bd8121a2c4b423a0467989c776027..50f69377523818ff1177b648a6efb6427b51ff98 100644 (file)
@@ -26,10 +26,10 @@ extern "C" {
 #endif
 
 #ifdef _MSC_VER
-   /* Get _byteswap_ushort(), _byteswap_ulong(), _byteswap_uint64() */
-#  include <intrin.h>
+#  include <intrin.h>             // _byteswap_uint64()
 #endif
 
+
 static inline uint16_t
 _Py_bswap16(uint16_t word)
 {
index 0e3a99be8c36aac273723dc4f975c62571eb4995..f32ed3b7e30b7e96b5c4755e1b275d2c26e04c77 100644 (file)
@@ -8,6 +8,9 @@ extern "C" {
 #  error "this header requires Py_BUILD_CORE define"
 #endif
 
+#include "pycore_interp.h"        // PyInterpreterState.eval_frame
+#include "pycore_pystate.h"       // _PyThreadState_GET()
+
 /* Forward declarations */
 struct pyruntimestate;
 struct _ceval_runtime_state;
@@ -16,10 +19,6 @@ struct _ceval_runtime_state;
 #  define Py_DEFAULT_RECURSION_LIMIT 1000
 #endif
 
-#include "pycore_interp.h"        // PyInterpreterState.eval_frame
-#include "pycore_pystate.h"       // _PyThreadState_GET()
-
-
 extern void _Py_FinishPendingCalls(PyThreadState *tstate);
 extern void _PyEval_InitState(PyInterpreterState *, PyThread_type_lock);
 extern void _PyEval_FiniState(struct _ceval_state *ceval);
index 1ebfcc9bebd0ab62ee8b42d3898c206f5e0a67aa..6e3d669dc646af76f621c8014c91d036ae035209 100644 (file)
@@ -8,8 +8,6 @@ extern "C" {
 #  error "this header requires Py_BUILD_CORE define"
 #endif
 
-
-#include "pycore_atomic.h"          /* _Py_atomic_address */
 #include "pycore_gil.h"             // struct _gil_runtime_state
 
 
index 981c962bf7dfdfa31fd774550394efc5702d74dc..db8682a4c077aab5b83eca7fc87c12359fcae904 100644 (file)
@@ -10,7 +10,7 @@
    not present in unistd.h. But they still can be implemented as an external
    library (e.g. gnu pth in pthread emulation) */
 # ifdef HAVE_PTHREAD_H
-#  include <pthread.h> /* _POSIX_THREADS */
+#  include <pthread.h>            // _POSIX_THREADS
 # endif
 #endif
 
@@ -21,7 +21,7 @@
 #define Py_HAVE_CONDVAR
 
 #ifdef HAVE_PTHREAD_H
-#  include <pthread.h>
+#  include <pthread.h>            // pthread_mutex_t
 #endif
 
 #define PyMUTEX_T pthread_mutex_t
@@ -38,7 +38,7 @@
 
 /* include windows if it hasn't been done before */
 #define WIN32_LEAN_AND_MEAN
-#include <windows.h>
+#include <windows.h>              // CRITICAL_SECTION
 
 /* options */
 /* non-emulated condition variables are provided for those that want
index 52dfe3ef233874c9d21f3f5b7adc6db5cad78443..f1898cf873312bcbc4ce9f09bd231c1c5f89a332 100644 (file)
@@ -5,7 +5,7 @@
 #  error "this header requires Py_BUILD_CORE define"
 #endif
 
-#include "pycore_hamt.h"   /* PyHamtObject */
+#include "pycore_hamt.h"          // PyHamtObject
 
 
 extern PyTypeObject _PyContextTokenMissing_Type;
index 2ad6ef0f7c04d5cbe4d0ff548c9f934ec9cee2ed..df7bc7e58f6c9798221e3bf3bea76c43b7c5174b 100644 (file)
@@ -9,9 +9,7 @@ extern "C" {
 #  error "this header requires Py_BUILD_CORE define"
 #endif
 
-#include "pycore_dict_state.h"
-#include "pycore_object.h"
-#include "pycore_runtime.h"         // _PyRuntime
+#include "pycore_object.h"        // PyDictOrValues
 
 // Unsafe flavor of PyDict_GetItemWithError(): no error checking
 extern PyObject* _PyDict_GetItemWithError(PyObject *dp, PyObject *key);
index e6aec7745a64795a51f3ec702380d0338a59d537..6dd7d8d7ca9792e200d43c02867fb0bd59f12c53 100644 (file)
@@ -9,7 +9,7 @@ extern "C" {
 #endif
 
 #ifdef HAVE_SIGACTION
-#  include <signal.h>
+#  include <signal.h>             // sigaction
 #endif
 
 
index 25b383b9780adcf5be6b7e853fca988c2f52db17..96e3d1c7abcdde6c569a4d1d72b56d6c2ddf2415 100644 (file)
@@ -8,7 +8,8 @@ extern "C" {
 #  error "this header requires Py_BUILD_CORE define"
 #endif
 
-#include <locale.h>   /* struct lconv */
+#include <locale.h>               // struct lconv
+
 
 /* A routine to check if a file descriptor can be select()-ed. */
 #ifdef _MSC_VER
@@ -268,7 +269,7 @@ extern wchar_t *_Py_normpath_and_size(wchar_t *path, Py_ssize_t size, Py_ssize_t
 // so provide our own implementations. Remove them in case they get added
 // to the Games API family
 #if defined(MS_WINDOWS_GAMES) && !defined(MS_WINDOWS_DESKTOP)
-#include <winerror.h>
+#include <winerror.h>             // HRESULT
 
 extern HRESULT PathCchSkipRoot(const wchar_t *pszPath, const wchar_t **ppszRootEnd);
 #endif /* defined(MS_WINDOWS_GAMES) && !defined(MS_WINDOWS_DESKTOP) */
index 8ebad37b686cd4c9cdfd4236b2bd9387497f489e..a1a15070eef461d78d844e34d2f486be3ebcd735 100644 (file)
@@ -8,8 +8,8 @@ extern "C" {
 #  error "this header requires Py_BUILD_CORE define"
 #endif
 
-#include "pycore_atomic.h"    /* _Py_atomic_address */
-#include "pycore_condvar.h"   /* PyCOND_T */
+#include "pycore_atomic.h"        // _Py_atomic_address
+#include "pycore_condvar.h"       // PyCOND_T
 
 #ifndef Py_HAVE_CONDVAR
 #  error You need either a POSIX-compatible or a Windows system!
index 442f8516278b023a8603cd22fa39f7a9aa4dd3a9..327fcc24cb29f11a66f77af0918af127691eb78d 100644 (file)
@@ -8,11 +8,11 @@ extern "C" {
 #  error "this header requires Py_BUILD_CORE define"
 #endif
 
-#include "pycore_hashtable.h"       // _Py_hashtable_t
-#include "pycore_gc.h"              // PyGC_Head
+#include "pycore_context.h"         // _PyContextTokenMissing
+#include "pycore_gc.h"              // _PyGC_Head_UNUSED
 #include "pycore_global_strings.h"  // struct _Py_global_strings
 #include "pycore_hamt.h"            // PyHamtNode_Bitmap
-#include "pycore_context.h"         // _PyContextTokenMissing
+#include "pycore_hashtable.h"       // _Py_hashtable_t
 #include "pycore_typeobject.h"      // pytype_slotdef
 
 
index 34f572bd59296901011cb0afb7d64b3e95905331..e23f9931cea734907a0fdd17756c7759348529ba 100644 (file)
@@ -103,7 +103,7 @@ struct _import_state {
 };
 
 #ifdef HAVE_DLOPEN
-#  include <dlfcn.h>
+#  include <dlfcn.h>              // RTLD_NOW, RTLD_LAZY
 #  if HAVE_DECL_RTLD_NOW
 #    define _Py_DLOPEN_FLAGS RTLD_NOW
 #  else
index e15447acec2c0cac928f6ad0e382c7cada7b2591..43214aef7f7a1b45d91ffb8eb63531ca14aa9e1e 100644 (file)
@@ -6,9 +6,7 @@
 #endif
 
 #include "pycore_bitutils.h"      // _Py_popcount32
-#include "pycore_frame.h"
-
-#include "cpython/code.h"
+#include "pycore_frame.h"         // _PyInterpreterFrame
 
 #ifdef __cplusplus
 extern "C" {
index 91c473e58eaba26e7e421691f6b4ae42dd765367..c21c352608d161b497379f25b951e6e638e858bb 100644 (file)
@@ -8,7 +8,7 @@ extern "C" {
 #  error "this header requires Py_BUILD_CORE define"
 #endif
 
-#include <stdbool.h>
+#include <stdbool.h>              // bool
 
 #include "pycore_ast_state.h"     // struct ast_state
 #include "pycore_atexit.h"        // struct atexit_state
@@ -21,16 +21,16 @@ extern "C" {
 #include "pycore_exceptions.h"    // struct _Py_exc_state
 #include "pycore_floatobject.h"   // struct _Py_float_state
 #include "pycore_function.h"      // FUNC_MAX_WATCHERS
-#include "pycore_genobject.h"     // struct _Py_async_gen_state
 #include "pycore_gc.h"            // struct _gc_runtime_state
-#include "pycore_global_objects.h"  // struct _Py_interp_static_objects
+#include "pycore_genobject.h"     // struct _Py_async_gen_state
+#include "pycore_global_objects.h"// struct _Py_interp_cached_objects
 #include "pycore_import.h"        // struct _import_state
 #include "pycore_instruments.h"   // _PY_MONITORING_EVENTS
 #include "pycore_list.h"          // struct _Py_list_state
-#include "pycore_object_state.h"   // struct _py_object_state
-#include "pycore_obmalloc.h"      // struct obmalloc_state
+#include "pycore_object_state.h"  // struct _py_object_state
+#include "pycore_obmalloc.h"      // struct _obmalloc_state
 #include "pycore_tuple.h"         // struct _Py_tuple_state
-#include "pycore_typeobject.h"    // struct type_cache
+#include "pycore_typeobject.h"    // struct types_state
 #include "pycore_unicodeobject.h" // struct _Py_unicode_state
 #include "pycore_warnings.h"      // struct _warnings_runtime_state
 
index 857d6efec3b3b1ffd865f5a0656d6970895fbb98..5e2d13a522055698f2ed0a60aa8a2c0d5517e654 100644 (file)
@@ -12,7 +12,6 @@ extern "C" {
 #include "pycore_gc.h"            // _PyObject_GC_IS_TRACKED()
 #include "pycore_interp.h"        // PyInterpreterState.gc
 #include "pycore_pystate.h"       // _PyInterpreterState_GET()
-#include "pycore_runtime.h"       // _PyRuntime
 
 /* Check if an object is consistent. For example, ensure that the reference
    counter is greater than or equal to 1, and ensure that ob_type is not NULL.
index fab91e611b6175d3aa6748d5fa98816203f8d4b0..e35db0c4c5a59d8c442c13f0b7e9779b453192f6 100644 (file)
@@ -7,7 +7,7 @@
 #  error "this header requires Py_BUILD_CORE define"
 #endif
 
-#include <stdbool.h>
+#include <stdbool.h>              // bool
 
 
 #define IS_PSEUDO_INSTR(OP)  ( \
index 50ff2af38d2cbe5c452ea41ae0dabd09d1266e3d..f17612908cebdc03cd148b0a73a3fa61614e505b 100644 (file)
@@ -8,7 +8,7 @@ extern "C" {
 #  error "this header requires Py_BUILD_CORE define"
 #endif
 
-#include "pycore_opcode.h"        // _PyOpcode_Jump
+#include "pycore_opcode.h"        // JUMP_FORWARD
 
 
 #define MAX_REAL_OPCODE 254
index 2ae657c4e117ffcd5ef2d7309a9bde2e67d0eb12..f9f16c48cbc21c23bab8e6ba13a495f7b13ebba1 100644 (file)
@@ -8,7 +8,7 @@ extern "C" {
 #  error "this header requires Py_BUILD_CORE define"
 #endif
 
-#include "pycore_uops.h"
+#include "pycore_uops.h"          // _PyUOpInstruction
 
 int _Py_uop_analyze_and_optimize(PyCodeObject *code,
     _PyUOpInstruction *trace, int trace_len, int curr_stackentries);
index 78232738cb09d5128c0b51c105553b15779650e2..119fa16fb911aef199ea3102731a0ee96ac50694 100644 (file)
@@ -8,8 +8,6 @@ extern "C" {
 #  error "this header requires Py_BUILD_CORE define"
 #endif
 
-#include "pycore_pymem.h"
-
 
 /********************************/
 /* the allocators' initializers */
index acc6cf953343fbbe9efc3e6a8fbc0aa154344691..f6ca9102b139e6194c24b0ee0b397d04e50e843c 100644 (file)
@@ -8,7 +8,7 @@ extern "C" {
 #  error "this header requires Py_BUILD_CORE define"
 #endif
 
-#include "pycore_runtime.h"   /* PyRuntimeState */
+#include "pycore_runtime.h"       // _PyRuntime
 
 
 /* Check if the current thread is the main thread.
index f53921494c158f336a54b27260f4672d805bb328..44846c0fc4b4c34dcb6b53ca14807f1892f5e910 100644 (file)
@@ -13,9 +13,9 @@ extern "C" {
 /* This means pthreads are not implemented in libc headers, hence the macro
    not present in unistd.h. But they still can be implemented as an external
    library (e.g. gnu pth in pthread emulation) */
-# ifdef HAVE_PTHREAD_H
-#  include <pthread.h> /* _POSIX_THREADS */
-# endif
+#  ifdef HAVE_PTHREAD_H
+#    include <pthread.h>            // _POSIX_THREADS
+#  endif
 # ifndef _POSIX_THREADS
 /* Check if we're running on HP-UX and _SC_THREADS is defined. If so, then
    enough of the Posix threads package is implemented to support python
@@ -34,12 +34,12 @@ extern "C" {
 #endif /* _POSIX_THREADS */
 
 #if defined(_POSIX_THREADS) || defined(HAVE_PTHREAD_STUBS)
-# define _USE_PTHREADS
+#  define _USE_PTHREADS
 #endif
 
 #if defined(_USE_PTHREADS) && defined(HAVE_PTHREAD_CONDATTR_SETCLOCK) && defined(HAVE_CLOCK_GETTIME) && defined(CLOCK_MONOTONIC)
 // monotonic is supported statically.  It doesn't mean it works on runtime.
-# define CONDATTR_MONOTONIC
+#  define CONDATTR_MONOTONIC
 #endif
 
 
index 63b485027486bb1ceddf1fbf1406fcfb7409799f..4a460803c69bdec0812cf8635a0b1cc520d0914a 100644 (file)
@@ -8,24 +8,23 @@ extern "C" {
 #  error "this header requires Py_BUILD_CORE define"
 #endif
 
-#include "pycore_atexit.h"          // struct atexit_runtime_state
-#include "pycore_atomic.h"          /* _Py_atomic_address */
+#include "pycore_atexit.h"          // struct _atexit_runtime_state
+#include "pycore_atomic.h"          // _Py_atomic_address
 #include "pycore_ceval_state.h"     // struct _ceval_runtime_state
-#include "pycore_floatobject.h"     // struct _Py_float_runtime_state
 #include "pycore_faulthandler.h"    // struct _faulthandler_runtime_state
-#include "pycore_global_objects.h"  // struct _Py_global_objects
+#include "pycore_floatobject.h"     // struct _Py_float_runtime_state
 #include "pycore_import.h"          // struct _import_runtime_state
 #include "pycore_interp.h"          // PyInterpreterState
 #include "pycore_object_state.h"    // struct _py_object_runtime_state
 #include "pycore_parser.h"          // struct _parser_runtime_state
-#include "pycore_pymem.h"           // struct _pymem_allocators
 #include "pycore_pyhash.h"          // struct pyhash_runtime_state
+#include "pycore_pymem.h"           // struct _pymem_allocators
 #include "pycore_pythread.h"        // struct _pythread_runtime_state
 #include "pycore_signal.h"          // struct _signals_runtime_state
 #include "pycore_time.h"            // struct _time_runtime_state
 #include "pycore_tracemalloc.h"     // struct _tracemalloc_runtime_state
-#include "pycore_typeobject.h"      // struct types_runtime_state
-#include "pycore_unicodeobject.h"   // struct _Py_unicode_runtime_ids
+#include "pycore_typeobject.h"      // struct _types_runtime_state
+#include "pycore_unicodeobject.h"   // struct _Py_unicode_runtime_state
 
 struct _getargs_runtime_state {
     PyThread_type_lock mutex;
index ea29c69f59acc7f0c4cd3b198dfd012cf12d2539..c775a8a7e7eefa07026dd174c0c35f65580f00fa 100644 (file)
@@ -8,11 +8,17 @@ extern "C" {
 #  error "this header requires Py_BUILD_CORE define"
 #endif
 
-#include "pycore_long.h"
-#include "pycore_object.h"
-#include "pycore_parser.h"
-#include "pycore_pymem_init.h"
-#include "pycore_obmalloc_init.h"
+#include "pycore_ceval_state.h"   // _PyEval_RUNTIME_PERF_INIT
+#include "pycore_faulthandler.h"  // _faulthandler_runtime_state_INIT
+#include "pycore_floatobject.h"   // _py_float_format_unknown
+#include "pycore_object.h"        // _PyObject_HEAD_INIT
+#include "pycore_obmalloc_init.h" // _obmalloc_global_state_INIT
+#include "pycore_parser.h"        // _parser_runtime_state_INIT
+#include "pycore_pyhash.h"        // pyhash_state_INIT
+#include "pycore_pymem_init.h"    // _pymem_allocators_standard_INIT
+#include "pycore_runtime_init_generated.h"  // _Py_bytes_characters_INIT
+#include "pycore_signal.h"        // _signals_RUNTIME_INIT
+#include "pycore_tracemalloc.h"   // _tracemalloc_runtime_state_INIT
 
 
 extern PyTypeObject _PyExc_MemoryError;
index 8c0fcdb1bdae1c1503b5839443f32e0a830a8861..694a409fbf4f47987a06ff7f1b539328531f4df2 100644 (file)
@@ -8,6 +8,9 @@ extern "C" {
 #  error "this header requires Py_BUILD_CORE define"
 #endif
 
+#include "pycore_long.h"          // _PyLong_DIGIT_INIT()
+
+
 /* The following is auto-generated by Tools/build/generate_global_objects.py. */
 #define _Py_small_ints_INIT { \
     _PyLong_DIGIT_INIT(-5), \
index 46b57d556e5ef443818455c0b29c85be025631c8..8f876759c0d07f6a751464eab6696469bb0a21a4 100644 (file)
@@ -10,8 +10,8 @@ extern "C" {
 #  error "this header requires Py_BUILD_CORE define"
 #endif
 
-#include "pycore_atomic.h"         // _Py_atomic_address
-#include <signal.h>                // NSIG
+#include "pycore_atomic.h"        // _Py_atomic_address
+#include <signal.h>               // NSIG
 
 
 // Restore signals that the interpreter has called SIG_IGN on to SIG_DFL.
index aba672effe3928d0b50347e8cba3077c46e4fa0c..4d6a0189c4afeeb46b2179a9341fa875db83c9bd 100644 (file)
@@ -4,12 +4,12 @@
 extern "C" {
 #endif
 
-#include "pycore_moduleobject.h"
-
 #ifndef Py_BUILD_CORE
 #  error "this header requires Py_BUILD_CORE define"
 #endif
 
+#include "pycore_moduleobject.h"  // PyModuleObject
+
 
 /* state */
 
index c7cfe50b52faffcb19847c57abcd8e1ce859db94..41495e2012f15229615fb55ef6d0bc4d708756e2 100644 (file)
@@ -12,7 +12,7 @@
 #include "pycore_ceval.h"           // _Py_EnterRecursiveCall()
 #include "pycore_runtime.h"         // _PyRuntime
 
-#include "pycore_global_objects.h"  // _Py_ID()
+#include "pycore_global_strings.h"  // _Py_ID()
 #include <stdbool.h>                // bool
 
 
index 35599f8baa204d9ca95c982204aab513931aedd5..a7a98d1eea5bd15f810c95823bc8dc6719e66e53 100644 (file)
@@ -18,8 +18,8 @@
 #undef NDEBUG
 
 #include "Python.h"
-#include "frameobject.h"          // PyFrame_New
-#include "marshal.h"              // PyMarshal_WriteLongToFile
+#include "frameobject.h"          // PyFrame_New()
+#include "marshal.h"              // PyMarshal_WriteLongToFile()
 
 #include <float.h>                // FLT_MAX
 #include <signal.h>
@@ -37,7 +37,7 @@
 #endif
 
 #ifdef bool
-#  error "The public headers should not include <stdbool.h>, see bpo-46748"
+#  error "The public headers should not include <stdbool.h>, see gh-48924"
 #endif
 
 // Several parts of this module are broken out into files in _testcapi/.
index d1082c7dae8aeee3eb77e1373235a33a13f34f32..5571ae463373e07112b6eb84c258733b26068b01 100644 (file)
 #undef NDEBUG
 
 #include "Python.h"
-#include "pycore_atomic_funcs.h" // _Py_atomic_int_get()
-#include "pycore_bitutils.h"     // _Py_bswap32()
-#include "pycore_bytesobject.h"  // _PyBytes_Find()
-#include "pycore_compile.h"      // _PyCompile_CodeGen, _PyCompile_OptimizeCfg, _PyCompile_Assemble, _PyCompile_CleanDoc
-#include "pycore_ceval.h"        // _PyEval_AddPendingCall
-#include "pycore_dict.h"        // _PyDictOrValues_GetValues
-#include "pycore_fileutils.h"    // _Py_normpath
-#include "pycore_frame.h"        // _PyInterpreterFrame
-#include "pycore_gc.h"           // PyGC_Head
-#include "pycore_hashtable.h"    // _Py_hashtable_new()
-#include "pycore_initconfig.h"   // _Py_GetConfigsAsDict()
-#include "pycore_interp.h"       // _PyInterpreterState_GetConfigCopy()
-#include "pycore_object.h"       // _PyObject_IsFreed()
-#include "pycore_pathconfig.h"   // _PyPathConfig_ClearGlobal()
-#include "pycore_pyerrors.h"     // _Py_UTF8_Edit_Cost()
-#include "pycore_pystate.h"      // _PyThreadState_GET()
-
-#include "frameobject.h"
-#include "interpreteridobject.h" // PyInterpreterID_LookUp()
-#include "osdefs.h"              // MAXPATHLEN
+#include "pycore_atomic_funcs.h"  // _Py_atomic_int_get()
+#include "pycore_bitutils.h"      // _Py_bswap32()
+#include "pycore_bytesobject.h"   // _PyBytes_Find()
+#include "pycore_compile.h"       // _PyCompile_CodeGen, _PyCompile_OptimizeCfg, _PyCompile_Assemble, _PyCompile_CleanDoc
+#include "pycore_ceval.h"         // _PyEval_AddPendingCall
+#include "pycore_dict.h"          // _PyDictOrValues_GetValues()
+#include "pycore_fileutils.h"     // _Py_normpath
+#include "pycore_frame.h"         // _PyInterpreterFrame
+#include "pycore_gc.h"            // PyGC_Head
+#include "pycore_hashtable.h"     // _Py_hashtable_new()
+#include "pycore_initconfig.h"    // _Py_GetConfigsAsDict()
+#include "pycore_interp.h"        // _PyInterpreterState_GetConfigCopy()
+#include "pycore_object.h"        // _PyObject_IsFreed()
+#include "pycore_pathconfig.h"    // _PyPathConfig_ClearGlobal()
+#include "pycore_pyerrors.h"      // _Py_UTF8_Edit_Cost()
+#include "pycore_pystate.h"       // _PyThreadState_GET()
+
+#include "interpreteridobject.h"  // PyInterpreterID_LookUp()
 
 #include "clinic/_testinternalcapi.c.h"
 
index 1733cd4b15aa4c9a7c15909f45ee583a28211f77..bf144871bb7364cdde6db84b09cb43afe4b691f2 100755 (executable)
@@ -1585,7 +1585,7 @@ def write_header(mod, metadata, f):
         #  error "this header requires Py_BUILD_CORE define"
         #endif
 
-        #include "pycore_asdl.h"
+        #include "pycore_asdl.h"          // _ASDL_SEQ_HEAD
 
     """).lstrip())
 
index c3b729df44a6a286e5a0586e12fdf12d18f6a0d8..6ee68363058116077ab12ee88ccda1c79bcba930 100644 (file)
@@ -410,7 +410,7 @@ class Generator(Analyzer):
                 #endif
             """).strip())
 
-            self.out.emit("\n#include <stdbool.h>")
+            self.out.emit("\n#include <stdbool.h>              // bool")
 
             self.write_pseudo_instrs()