[Python-checkins] bpo-40268: Remove unused structmember.h includes (GH-19530)

Victor Stinner webhook-mailer at python.org
Tue Apr 14 20:35:49 EDT 2020


https://github.com/python/cpython/commit/4a21e57fe55076c77b0ee454e1994ca544d09dc0
commit: 4a21e57fe55076c77b0ee454e1994ca544d09dc0
branch: master
author: Victor Stinner <vstinner at python.org>
committer: GitHub <noreply at github.com>
date: 2020-04-15T02:35:41+02:00
summary:

bpo-40268: Remove unused structmember.h includes (GH-19530)

If only offsetof() is needed: include stddef.h instead.

When structmember.h is used, add a comment explaining that
PyMemberDef is used.

files:
M Modules/_abc.c
M Modules/_asynciomodule.c
M Modules/_bz2module.c
M Modules/_collectionsmodule.c
M Modules/_csv.c
M Modules/_ctypes/_ctypes.c
M Modules/_ctypes/callproc.c
M Modules/_datetimemodule.c
M Modules/_decimal/_decimal.c
M Modules/_elementtree.c
M Modules/_functoolsmodule.c
M Modules/_hashopenssl.c
M Modules/_io/_iomodule.c
M Modules/_io/bufferedio.c
M Modules/_io/bytesio.c
M Modules/_io/fileio.c
M Modules/_io/iobase.c
M Modules/_io/stringio.c
M Modules/_io/textio.c
M Modules/_io/winconsoleio.c
M Modules/_json.c
M Modules/_lzmamodule.c
M Modules/_multiprocessing/posixshmem.c
M Modules/_pickle.c
M Modules/_queuemodule.c
M Modules/_sqlite/connection.c
M Modules/_sqlite/microprotocols.c
M Modules/_sre.c
M Modules/_statisticsmodule.c
M Modules/_struct.c
M Modules/_testcapimodule.c
M Modules/_threadmodule.c
M Modules/_winapi.c
M Modules/arraymodule.c
M Modules/cjkcodecs/multibytecodec.c
M Modules/itertoolsmodule.c
M Modules/mmapmodule.c
M Modules/ossaudiodev.c
M Modules/overlapped.c
M Modules/posixmodule.c
M Modules/pyexpat.c
M Modules/selectmodule.c
M Modules/sha256module.c
M Modules/sha512module.c
M Modules/socketmodule.c
M Modules/unicodedata.c
M Modules/xxsubtype.c
M Modules/zlibmodule.c
M Objects/abstract.c
M Objects/bytearrayobject.c
M Objects/classobject.c
M Objects/codeobject.c
M Objects/complexobject.c
M Objects/descrobject.c
M Objects/exceptions.c
M Objects/frameobject.c
M Objects/funcobject.c
M Objects/genericaliasobject.c
M Objects/genobject.c
M Objects/methodobject.c
M Objects/moduleobject.c
M Objects/namespaceobject.c
M Objects/odictobject.c
M Objects/rangeobject.c
M Objects/setobject.c
M Objects/sliceobject.c
M Objects/structseq.c
M Objects/typeobject.c
M Objects/weakrefobject.c
M PC/winreg.c
M Parser/asdl_c.py
M Python/Python-ast.c
M Python/ceval.c
M Python/context.c
M Python/hamt.c
M Python/structmember.c
M Python/symtable.c
M Python/traceback.c

diff --git a/Modules/_abc.c b/Modules/_abc.c
index 1efc98bf72c07..7c040ef80ba3d 100644
--- a/Modules/_abc.c
+++ b/Modules/_abc.c
@@ -1,7 +1,6 @@
 /* ABCMeta implementation */
 
 #include "Python.h"
-#include "structmember.h"
 #include "clinic/_abc.c.h"
 
 /*[clinic input]
diff --git a/Modules/_asynciomodule.c b/Modules/_asynciomodule.c
index c10866aba7ce3..96a99fe49ceb0 100644
--- a/Modules/_asynciomodule.c
+++ b/Modules/_asynciomodule.c
@@ -1,5 +1,5 @@
 #include "Python.h"
-#include "structmember.h"
+#include <stddef.h>               // offsetof()
 
 
 /*[clinic input]
diff --git a/Modules/_bz2module.c b/Modules/_bz2module.c
index d46f96cc866ef..880632c62349f 100644
--- a/Modules/_bz2module.c
+++ b/Modules/_bz2module.c
@@ -3,7 +3,7 @@
 #define PY_SSIZE_T_CLEAN
 
 #include "Python.h"
-#include "structmember.h"
+#include "structmember.h"         // PyMemberDef
 
 #include <bzlib.h>
 #include <stdio.h>
diff --git a/Modules/_collectionsmodule.c b/Modules/_collectionsmodule.c
index 181e3229da4f2..978ea03bd9058 100644
--- a/Modules/_collectionsmodule.c
+++ b/Modules/_collectionsmodule.c
@@ -1,10 +1,10 @@
 #include "Python.h"
-#include "structmember.h"
+#include "structmember.h"         // PyMemberDef
 
 #ifdef STDC_HEADERS
 #include <stddef.h>
 #else
-#include <sys/types.h>          /* For size_t */
+#include <sys/types.h>            // size_t
 #endif
 
 /*[clinic input]
diff --git a/Modules/_csv.c b/Modules/_csv.c
index 950b0d7005522..3a52632ccfd45 100644
--- a/Modules/_csv.c
+++ b/Modules/_csv.c
@@ -11,7 +11,7 @@ module instead.
 #define MODULE_VERSION "1.0"
 
 #include "Python.h"
-#include "structmember.h"
+#include "structmember.h"         // PyMemberDef
 #include <stdbool.h>
 
 
diff --git a/Modules/_ctypes/_ctypes.c b/Modules/_ctypes/_ctypes.c
index 5548c50cf53e4..ceae67ebb1612 100644
--- a/Modules/_ctypes/_ctypes.c
+++ b/Modules/_ctypes/_ctypes.c
@@ -102,7 +102,7 @@ bytes(cdata)
 #define PY_SSIZE_T_CLEAN
 
 #include "Python.h"
-#include "structmember.h"
+#include "structmember.h"         // PyMemberDef
 
 #include <ffi.h>
 #ifdef MS_WIN32
diff --git a/Modules/_ctypes/callproc.c b/Modules/_ctypes/callproc.c
index 815fc6664d0ba..5c1ecabd8164d 100644
--- a/Modules/_ctypes/callproc.c
+++ b/Modules/_ctypes/callproc.c
@@ -55,7 +55,7 @@
  */
 
 #include "Python.h"
-#include "structmember.h"
+#include "structmember.h"         // PyMemberDef
 
 #ifdef MS_WIN32
 #include <windows.h>
@@ -751,7 +751,7 @@ static int ConvParam(PyObject *obj, Py_ssize_t index, struct argument *pa)
 #if defined(MS_WIN32) && !defined(_WIN32_WCE)
 /*
 Per: https://msdn.microsoft.com/en-us/library/7572ztz4.aspx
-To be returned by value in RAX, user-defined types must have a length 
+To be returned by value in RAX, user-defined types must have a length
 of 1, 2, 4, 8, 16, 32, or 64 bits
 */
 int can_return_struct_as_int(size_t s)
diff --git a/Modules/_datetimemodule.c b/Modules/_datetimemodule.c
index f7c1b69def3e7..9bdc52e949718 100644
--- a/Modules/_datetimemodule.c
+++ b/Modules/_datetimemodule.c
@@ -9,7 +9,7 @@
 
 #include "Python.h"
 #include "datetime.h"
-#include "structmember.h"
+#include "structmember.h"         // PyMemberDef
 
 #include <time.h>
 
diff --git a/Modules/_decimal/_decimal.c b/Modules/_decimal/_decimal.c
index 99f12364ad81b..20ba8fb77ad44 100644
--- a/Modules/_decimal/_decimal.c
+++ b/Modules/_decimal/_decimal.c
@@ -28,7 +28,6 @@
 
 #include <Python.h>
 #include "longintrepr.h"
-#include "structmember.h"
 #include "complexobject.h"
 #include "mpdecimal.h"
 
diff --git a/Modules/_elementtree.c b/Modules/_elementtree.c
index 03ac6b6c0743d..2c92a8aedb5a8 100644
--- a/Modules/_elementtree.c
+++ b/Modules/_elementtree.c
@@ -14,7 +14,7 @@
 #define PY_SSIZE_T_CLEAN
 
 #include "Python.h"
-#include "structmember.h"
+#include "structmember.h"         // PyMemberDef
 
 /* -------------------------------------------------------------------- */
 /* configuration */
diff --git a/Modules/_functoolsmodule.c b/Modules/_functoolsmodule.c
index d9536bb4e92d0..90e388c1c635c 100644
--- a/Modules/_functoolsmodule.c
+++ b/Modules/_functoolsmodule.c
@@ -1,8 +1,8 @@
 #include "Python.h"
 #include "pycore_pymem.h"
-#include "pycore_pystate.h"      // _PyThreadState_GET()
+#include "pycore_pystate.h"       // _PyThreadState_GET()
 #include "pycore_tupleobject.h"
-#include "structmember.h"
+#include "structmember.h"         // PyMemberDef
 
 /* _functools module written and maintained
    by Hye-Shik Chang <perky at FreeBSD.org>
diff --git a/Modules/_hashopenssl.c b/Modules/_hashopenssl.c
index 1782636dbc6d7..0919cd3f47caa 100644
--- a/Modules/_hashopenssl.c
+++ b/Modules/_hashopenssl.c
@@ -14,7 +14,6 @@
 #define PY_SSIZE_T_CLEAN
 
 #include "Python.h"
-#include "structmember.h"
 #include "hashlib.h"
 #include "pystrhex.h"
 
diff --git a/Modules/_io/_iomodule.c b/Modules/_io/_iomodule.c
index 571f22552527f..d7cadacea1b5b 100644
--- a/Modules/_io/_iomodule.c
+++ b/Modules/_io/_iomodule.c
@@ -9,7 +9,6 @@
 
 #define PY_SSIZE_T_CLEAN
 #include "Python.h"
-#include "structmember.h"
 #include "_iomodule.h"
 
 #ifdef HAVE_SYS_TYPES_H
diff --git a/Modules/_io/bufferedio.c b/Modules/_io/bufferedio.c
index f243ac84e9e77..f8e21f206f316 100644
--- a/Modules/_io/bufferedio.c
+++ b/Modules/_io/bufferedio.c
@@ -10,7 +10,7 @@
 #define PY_SSIZE_T_CLEAN
 #include "Python.h"
 #include "pycore_object.h"
-#include "structmember.h"
+#include "structmember.h"         // PyMemberDef
 #include "_iomodule.h"
 
 /*[clinic input]
diff --git a/Modules/_io/bytesio.c b/Modules/_io/bytesio.c
index f4261b3713ac1..2468f45f941e2 100644
--- a/Modules/_io/bytesio.c
+++ b/Modules/_io/bytesio.c
@@ -1,6 +1,6 @@
 #include "Python.h"
 #include "pycore_object.h"
-#include "structmember.h"       /* for offsetof() */
+#include <stddef.h>               // offsetof()
 #include "_iomodule.h"
 
 /*[clinic input]
diff --git a/Modules/_io/fileio.c b/Modules/_io/fileio.c
index 1855b83449d2a..caf91dfdb749e 100644
--- a/Modules/_io/fileio.c
+++ b/Modules/_io/fileio.c
@@ -3,7 +3,7 @@
 #define PY_SSIZE_T_CLEAN
 #include "Python.h"
 #include "pycore_object.h"
-#include "structmember.h"
+#include "structmember.h"         // PyMemberDef
 #include <stdbool.h>
 #ifdef HAVE_SYS_TYPES_H
 #include <sys/types.h>
diff --git a/Modules/_io/iobase.c b/Modules/_io/iobase.c
index 924ffb57ca95c..a8e55c34799bd 100644
--- a/Modules/_io/iobase.c
+++ b/Modules/_io/iobase.c
@@ -11,7 +11,7 @@
 #define PY_SSIZE_T_CLEAN
 #include "Python.h"
 #include "pycore_object.h"
-#include "structmember.h"
+#include <stddef.h>               // offsetof()
 #include "_iomodule.h"
 
 /*[clinic input]
diff --git a/Modules/_io/stringio.c b/Modules/_io/stringio.c
index 9feb76e7ffaf4..e76152e617bdc 100644
--- a/Modules/_io/stringio.c
+++ b/Modules/_io/stringio.c
@@ -1,6 +1,6 @@
 #define PY_SSIZE_T_CLEAN
 #include "Python.h"
-#include "structmember.h"
+#include <stddef.h>               // offsetof()
 #include "pycore_accu.h"
 #include "pycore_object.h"
 #include "_iomodule.h"
diff --git a/Modules/_io/textio.c b/Modules/_io/textio.c
index 9e33c1ed17b0f..1abc9ca6f206a 100644
--- a/Modules/_io/textio.c
+++ b/Modules/_io/textio.c
@@ -8,10 +8,10 @@
 
 #define PY_SSIZE_T_CLEAN
 #include "Python.h"
-#include "pycore_interp.h"      // PyInterpreterState.fs_codec
+#include "pycore_interp.h"        // PyInterpreterState.fs_codec
 #include "pycore_object.h"
-#include "pycore_pystate.h"     // _PyInterpreterState_GET()
-#include "structmember.h"
+#include "pycore_pystate.h"       // _PyInterpreterState_GET()
+#include "structmember.h"         // PyMemberDef
 #include "_iomodule.h"
 
 /*[clinic input]
diff --git a/Modules/_io/winconsoleio.c b/Modules/_io/winconsoleio.c
index 94760acd47bf2..a83ef37a1fcf7 100644
--- a/Modules/_io/winconsoleio.c
+++ b/Modules/_io/winconsoleio.c
@@ -12,7 +12,7 @@
 
 #ifdef MS_WINDOWS
 
-#include "structmember.h"
+#include "structmember.h"         // PyMemberDef
 #ifdef HAVE_SYS_TYPES_H
 #include <sys/types.h>
 #endif
diff --git a/Modules/_json.c b/Modules/_json.c
index 17544165d8241..075aa3d2f4f6c 100644
--- a/Modules/_json.c
+++ b/Modules/_json.c
@@ -9,7 +9,7 @@
 #endif
 
 #include "Python.h"
-#include "structmember.h"
+#include "structmember.h"         // PyMemberDef
 #include "pycore_accu.h"
 
 typedef struct {
diff --git a/Modules/_lzmamodule.c b/Modules/_lzmamodule.c
index eac36b2d72f22..2a62a68356850 100644
--- a/Modules/_lzmamodule.c
+++ b/Modules/_lzmamodule.c
@@ -8,7 +8,7 @@
 #define PY_SSIZE_T_CLEAN
 
 #include "Python.h"
-#include "structmember.h"
+#include "structmember.h"         // PyMemberDef
 
 #include <stdarg.h>
 #include <string.h>
diff --git a/Modules/_multiprocessing/posixshmem.c b/Modules/_multiprocessing/posixshmem.c
index 2049dbbc6fa83..436ac6d6b39f4 100644
--- a/Modules/_multiprocessing/posixshmem.c
+++ b/Modules/_multiprocessing/posixshmem.c
@@ -5,7 +5,6 @@ posixshmem - A Python extension that provides shm_open() and shm_unlink()
 #define PY_SSIZE_T_CLEAN
 
 #include <Python.h>
-#include "structmember.h"
 
 // for shm_open() and shm_unlink()
 #ifdef HAVE_SYS_MMAN_H
diff --git a/Modules/_pickle.c b/Modules/_pickle.c
index 4b46c1fe2af68..d07fa53a1235e 100644
--- a/Modules/_pickle.c
+++ b/Modules/_pickle.c
@@ -9,7 +9,7 @@
 #endif
 
 #include "Python.h"
-#include "structmember.h"
+#include "structmember.h"         // PyMemberDef
 
 PyDoc_STRVAR(pickle_module_doc,
 "Optimized C implementation for the Python pickle module.");
diff --git a/Modules/_queuemodule.c b/Modules/_queuemodule.c
index 062102e5c81bc..b155ea942398b 100644
--- a/Modules/_queuemodule.c
+++ b/Modules/_queuemodule.c
@@ -1,5 +1,5 @@
 #include "Python.h"
-#include "structmember.h" /* offsetof */
+#include <stddef.h>               // offsetof()
 
 /*[clinic input]
 module _queue
diff --git a/Modules/_sqlite/connection.c b/Modules/_sqlite/connection.c
index 87a9f41021390..958be7d869794 100644
--- a/Modules/_sqlite/connection.c
+++ b/Modules/_sqlite/connection.c
@@ -23,7 +23,7 @@
 
 #include "cache.h"
 #include "module.h"
-#include "structmember.h"
+#include "structmember.h"         // PyMemberDef
 #include "connection.h"
 #include "statement.h"
 #include "cursor.h"
diff --git a/Modules/_sqlite/microprotocols.c b/Modules/_sqlite/microprotocols.c
index bb0d19f653b31..3b2d7f42b8735 100644
--- a/Modules/_sqlite/microprotocols.c
+++ b/Modules/_sqlite/microprotocols.c
@@ -24,7 +24,6 @@
  */
 
 #include <Python.h>
-#include <structmember.h>
 
 #include "cursor.h"
 #include "microprotocols.h"
diff --git a/Modules/_sre.c b/Modules/_sre.c
index 836d7961832ea..244e4f1f84dff 100644
--- a/Modules/_sre.c
+++ b/Modules/_sre.c
@@ -41,7 +41,7 @@ static const char copyright[] =
 #define PY_SSIZE_T_CLEAN
 
 #include "Python.h"
-#include "structmember.h" /* offsetof */
+#include "structmember.h"         // PyMemberDef
 
 #include "sre.h"
 
diff --git a/Modules/_statisticsmodule.c b/Modules/_statisticsmodule.c
index e98359a8d8dee..78c0676a01f02 100644
--- a/Modules/_statisticsmodule.c
+++ b/Modules/_statisticsmodule.c
@@ -1,7 +1,6 @@
 /* statistics accelerator C extension: _statistics module. */
 
 #include "Python.h"
-#include "structmember.h"
 #include "clinic/_statisticsmodule.c.h"
 
 /*[clinic input]
diff --git a/Modules/_struct.c b/Modules/_struct.c
index 82ac0a19208d9..13d8072f61218 100644
--- a/Modules/_struct.c
+++ b/Modules/_struct.c
@@ -6,7 +6,7 @@
 #define PY_SSIZE_T_CLEAN
 
 #include "Python.h"
-#include "structmember.h"
+#include "structmember.h"         // PyMemberDef
 #include <ctype.h>
 
 /*[clinic input]
diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c
index 8a76a3b1f2480..8e18b14a0a890 100644
--- a/Modules/_testcapimodule.c
+++ b/Modules/_testcapimodule.c
@@ -17,7 +17,7 @@
 #include "Python.h"
 #include "datetime.h"
 #include "marshal.h"
-#include "structmember.h"
+#include "structmember.h"         // PyMemberDef
 #include <float.h>
 #include <signal.h>
 
diff --git a/Modules/_threadmodule.c b/Modules/_threadmodule.c
index 6e7ee0f43e3e0..b3d90b22c5a66 100644
--- a/Modules/_threadmodule.c
+++ b/Modules/_threadmodule.c
@@ -4,9 +4,9 @@
 
 #include "Python.h"
 #include "pycore_pylifecycle.h"
-#include "pycore_interp.h"       // _PyInterpreterState.num_threads
-#include "pycore_pystate.h"      // _PyThreadState_Init()
-#include <stddef.h>              // offsetof()
+#include "pycore_interp.h"        // _PyInterpreterState.num_threads
+#include "pycore_pystate.h"       // _PyThreadState_Init()
+#include <stddef.h>               // offsetof()
 
 static PyObject *ThreadError;
 static PyObject *str_dict;
@@ -587,8 +587,6 @@ newlockobject(void)
 
 /* Thread-local objects */
 
-#include "structmember.h"
-
 /* Quick overview:
 
    We need to be able to reclaim reference cycles as soon as possible
diff --git a/Modules/_winapi.c b/Modules/_winapi.c
index 5dc50fbe4d59d..1b28adb0b3983 100644
--- a/Modules/_winapi.c
+++ b/Modules/_winapi.c
@@ -35,7 +35,7 @@
 /* See http://www.python.org/2.4/license for licensing details. */
 
 #include "Python.h"
-#include "structmember.h"
+#include "structmember.h"         // PyMemberDef
 
 #define WINDOWS_LEAN_AND_MEAN
 #include "windows.h"
@@ -1110,8 +1110,8 @@ _winapi_CreateProcess_impl(PyObject *module,
         }
     }
     else if (command_line != Py_None) {
-        PyErr_Format(PyExc_TypeError, 
-                     "CreateProcess() argument 2 must be str or None, not %s", 
+        PyErr_Format(PyExc_TypeError,
+                     "CreateProcess() argument 2 must be str or None, not %s",
                      Py_TYPE(command_line)->tp_name);
         goto cleanup;
     }
diff --git a/Modules/arraymodule.c b/Modules/arraymodule.c
index 95ee5f881cc35..4920ad7b82124 100644
--- a/Modules/arraymodule.c
+++ b/Modules/arraymodule.c
@@ -5,7 +5,7 @@
 
 #define PY_SSIZE_T_CLEAN
 #include "Python.h"
-#include "structmember.h"
+#include <stddef.h>               // offsetof()
 
 #ifdef STDC_HEADERS
 #include <stddef.h>
diff --git a/Modules/cjkcodecs/multibytecodec.c b/Modules/cjkcodecs/multibytecodec.c
index 319dc52749c65..86402768b6ee6 100644
--- a/Modules/cjkcodecs/multibytecodec.c
+++ b/Modules/cjkcodecs/multibytecodec.c
@@ -6,7 +6,7 @@
 
 #define PY_SSIZE_T_CLEAN
 #include "Python.h"
-#include "structmember.h"
+#include "structmember.h"         // PyMemberDef
 #include "multibytecodec.h"
 #include "clinic/multibytecodec.c.h"
 
diff --git a/Modules/itertoolsmodule.c b/Modules/itertoolsmodule.c
index 4ebeb741b6b5c..18fcebdf25b46 100644
--- a/Modules/itertoolsmodule.c
+++ b/Modules/itertoolsmodule.c
@@ -2,7 +2,7 @@
 #define PY_SSIZE_T_CLEAN
 #include "Python.h"
 #include "pycore_tupleobject.h"
-#include "structmember.h"
+#include <stddef.h>               // offsetof()
 
 /* Itertools module written and maintained
    by Raymond D. Hettinger <python at rcn.com>
diff --git a/Modules/mmapmodule.c b/Modules/mmapmodule.c
index a1267bdd549c1..6c503b3429b23 100644
--- a/Modules/mmapmodule.c
+++ b/Modules/mmapmodule.c
@@ -20,7 +20,7 @@
 
 #define PY_SSIZE_T_CLEAN
 #include <Python.h>
-#include "structmember.h"
+#include <stddef.h>               // offsetof()
 
 #ifndef MS_WINDOWS
 #define UNIX
diff --git a/Modules/ossaudiodev.c b/Modules/ossaudiodev.c
index 0711d519b5cb6..2a1ac10814a69 100644
--- a/Modules/ossaudiodev.c
+++ b/Modules/ossaudiodev.c
@@ -19,7 +19,7 @@
 
 #define PY_SSIZE_T_CLEAN
 #include "Python.h"
-#include "structmember.h"
+#include "structmember.h"         // PyMemberDef
 
 #ifdef HAVE_FCNTL_H
 #include <fcntl.h>
diff --git a/Modules/overlapped.c b/Modules/overlapped.c
index e8029e72f90c7..a16797c47b5d6 100644
--- a/Modules/overlapped.c
+++ b/Modules/overlapped.c
@@ -8,7 +8,7 @@
    Check itemsize */
 
 #include "Python.h"
-#include "structmember.h"
+#include "structmember.h"         // PyMemberDef
 
 #define WINDOWS_LEAN_AND_MEAN
 #include <winsock2.h>
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index 7ac74842152ef..f5beb09240130 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -35,10 +35,10 @@
 #  include <windows.h>
 #endif
 
-#include "pycore_ceval.h"     /* _PyEval_ReInitThreads() */
-#include "pycore_import.h"    /* _PyImport_ReInitLock() */
-#include "pycore_pystate.h"   /* _PyInterpreterState_GET() */
-#include "structmember.h"
+#include "pycore_ceval.h"         // _PyEval_ReInitThreads()
+#include "pycore_import.h"        // _PyImport_ReInitLock()
+#include "pycore_pystate.h"       // _PyInterpreterState_GET()
+#include "structmember.h"         // PyMemberDef
 #ifndef MS_WINDOWS
 #  include "posixmodule.h"
 #else
diff --git a/Modules/pyexpat.c b/Modules/pyexpat.c
index d930e3e12bbba..12ae66d945bda 100644
--- a/Modules/pyexpat.c
+++ b/Modules/pyexpat.c
@@ -1,7 +1,7 @@
 #include "Python.h"
 #include <ctype.h>
 
-#include "structmember.h"
+#include "structmember.h"         // PyMemberDef
 #include "frameobject.h"
 #include "expat.h"
 
diff --git a/Modules/selectmodule.c b/Modules/selectmodule.c
index 1d09adcfd35be..5c15e9973ab84 100644
--- a/Modules/selectmodule.c
+++ b/Modules/selectmodule.c
@@ -9,7 +9,7 @@
 #endif
 
 #include "Python.h"
-#include <structmember.h>
+#include "structmember.h"         // PyMemberDef
 
 #ifdef HAVE_SYS_DEVPOLL_H
 #include <sys/resource.h>
diff --git a/Modules/sha256module.c b/Modules/sha256module.c
index eee582cdd35cc..731082655c0ec 100644
--- a/Modules/sha256module.c
+++ b/Modules/sha256module.c
@@ -17,7 +17,7 @@
 /* SHA objects */
 
 #include "Python.h"
-#include "structmember.h"
+#include "structmember.h"         // PyMemberDef
 #include "hashlib.h"
 #include "pystrhex.h"
 
diff --git a/Modules/sha512module.c b/Modules/sha512module.c
index b2e07273436e9..38d303d369ec5 100644
--- a/Modules/sha512module.c
+++ b/Modules/sha512module.c
@@ -17,7 +17,7 @@
 /* SHA objects */
 
 #include "Python.h"
-#include "structmember.h"
+#include "structmember.h"         // PyMemberDef
 #include "hashlib.h"
 #include "pystrhex.h"
 
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c
index 2be0c103f802f..9db8535eb3434 100644
--- a/Modules/socketmodule.c
+++ b/Modules/socketmodule.c
@@ -101,7 +101,7 @@ Local naming conventions:
 
 #define PY_SSIZE_T_CLEAN
 #include "Python.h"
-#include "structmember.h"
+#include "structmember.h"         // PyMemberDef
 
 #ifdef _Py_MEMORY_SANITIZER
 # include <sanitizer/msan_interface.h>
diff --git a/Modules/unicodedata.c b/Modules/unicodedata.c
index 569e785b291d3..8a1198a2b712d 100644
--- a/Modules/unicodedata.c
+++ b/Modules/unicodedata.c
@@ -17,7 +17,7 @@
 
 #include "Python.h"
 #include "ucnhash.h"
-#include "structmember.h"
+#include "structmember.h"         // PyMemberDef
 
 #include <stdbool.h>
 
diff --git a/Modules/xxsubtype.c b/Modules/xxsubtype.c
index 031005d36e20f..7200337724e08 100644
--- a/Modules/xxsubtype.c
+++ b/Modules/xxsubtype.c
@@ -1,5 +1,5 @@
 #include "Python.h"
-#include "structmember.h"
+#include "structmember.h"         // PyMemberDef
 
 PyDoc_STRVAR(xxsubtype__doc__,
 "xxsubtype is an example module showing how to subtype builtin types from C.\n"
diff --git a/Modules/zlibmodule.c b/Modules/zlibmodule.c
index c2900a1243f29..fe27909ae8a75 100644
--- a/Modules/zlibmodule.c
+++ b/Modules/zlibmodule.c
@@ -6,7 +6,7 @@
 #define PY_SSIZE_T_CLEAN
 
 #include "Python.h"
-#include "structmember.h"
+#include "structmember.h"         // PyMemberDef
 #include "zlib.h"
 
 
diff --git a/Objects/abstract.c b/Objects/abstract.c
index 8e22dfeca99b4..6e390dd92c3ae 100644
--- a/Objects/abstract.c
+++ b/Objects/abstract.c
@@ -1,12 +1,12 @@
 /* Abstract Object Interface (many thanks to Jim Fulton) */
 
 #include "Python.h"
-#include "pycore_abstract.h"   // _PyIndex_Check()
-#include "pycore_ceval.h"      // _Py_EnterRecursiveCall()
+#include "pycore_abstract.h"      // _PyIndex_Check()
+#include "pycore_ceval.h"         // _Py_EnterRecursiveCall()
 #include "pycore_pyerrors.h"
-#include "pycore_pystate.h"    // _PyThreadState_GET()
+#include "pycore_pystate.h"       // _PyThreadState_GET()
 #include <ctype.h>
-#include "structmember.h" /* we need the offsetof() macro from there */
+#include <stddef.h>               // offsetof()
 #include "longintrepr.h"
 
 
diff --git a/Objects/bytearrayobject.c b/Objects/bytearrayobject.c
index 4d1ddec3822ff..f05a98acba043 100644
--- a/Objects/bytearrayobject.c
+++ b/Objects/bytearrayobject.c
@@ -2,11 +2,10 @@
 
 #define PY_SSIZE_T_CLEAN
 #include "Python.h"
-#include "pycore_abstract.h"   // _PyIndex_Check()
+#include "pycore_abstract.h"      // _PyIndex_Check()
 #include "pycore_bytes_methods.h"
 #include "pycore_object.h"
 #include "pycore_pymem.h"
-#include "structmember.h"
 #include "bytesobject.h"
 #include "pystrhex.h"
 
diff --git a/Objects/classobject.c b/Objects/classobject.c
index ce4bf7b5ff97c..242a6428b8ef2 100644
--- a/Objects/classobject.c
+++ b/Objects/classobject.c
@@ -4,8 +4,8 @@
 #include "pycore_object.h"
 #include "pycore_pyerrors.h"
 #include "pycore_pymem.h"
-#include "pycore_pystate.h"   // _PyThreadState_GET()
-#include "structmember.h"
+#include "pycore_pystate.h"       // _PyThreadState_GET()
+#include "structmember.h"         // PyMemberDef
 
 #define TP_DESCR_GET(t) ((t)->tp_descr_get)
 
diff --git a/Objects/codeobject.c b/Objects/codeobject.c
index da04af43a4a25..737635943aced 100644
--- a/Objects/codeobject.c
+++ b/Objects/codeobject.c
@@ -3,7 +3,7 @@
 #include "Python.h"
 #include "code.h"
 #include "opcode.h"
-#include "structmember.h"
+#include "structmember.h"         // PyMemberDef
 #include "pycore_code.h"
 #include "pycore_interp.h"        // PyInterpreterState.co_extra_freefuncs
 #include "pycore_pystate.h"       // _PyInterpreterState_GET()
diff --git a/Objects/complexobject.c b/Objects/complexobject.c
index 8d1461b29b488..a49037783be77 100644
--- a/Objects/complexobject.c
+++ b/Objects/complexobject.c
@@ -6,7 +6,7 @@
 /* Submitted by Jim Hugunin */
 
 #include "Python.h"
-#include "structmember.h"
+#include "structmember.h"         // PyMemberDef
 
 /*[clinic input]
 class complex "PyComplexObject *" "&PyComplex_Type"
diff --git a/Objects/descrobject.c b/Objects/descrobject.c
index fe7ba79770a6a..572baa5e312d2 100644
--- a/Objects/descrobject.c
+++ b/Objects/descrobject.c
@@ -5,7 +5,7 @@
 #include "pycore_object.h"
 #include "pycore_pystate.h"      // _PyThreadState_GET()
 #include "pycore_tupleobject.h"
-#include "structmember.h" /* Why is this not included in Python.h? */
+#include "structmember.h"         // PyMemberDef
 
 _Py_IDENTIFIER(getattr);
 
diff --git a/Objects/exceptions.c b/Objects/exceptions.c
index cb661f84ff2de..db1ff329ac143 100644
--- a/Objects/exceptions.c
+++ b/Objects/exceptions.c
@@ -9,7 +9,7 @@
 #include "pycore_initconfig.h"
 #include "pycore_object.h"
 #include "pycore_pymem.h"
-#include "structmember.h"
+#include "structmember.h"         // PyMemberDef
 #include "osdefs.h"
 
 
diff --git a/Objects/frameobject.c b/Objects/frameobject.c
index 3c140acad7ea6..bdd7862b3c9d2 100644
--- a/Objects/frameobject.c
+++ b/Objects/frameobject.c
@@ -7,7 +7,7 @@
 #include "code.h"
 #include "frameobject.h"
 #include "opcode.h"
-#include "structmember.h"
+#include "structmember.h"         // PyMemberDef
 
 #define OFF(x) offsetof(PyFrameObject, x)
 
diff --git a/Objects/funcobject.c b/Objects/funcobject.c
index af6766fbd7a9f..750c7aea0dfd6 100644
--- a/Objects/funcobject.c
+++ b/Objects/funcobject.c
@@ -6,7 +6,7 @@
 #include "pycore_pymem.h"
 #include "pycore_tupleobject.h"
 #include "code.h"
-#include "structmember.h"
+#include "structmember.h"         // PyMemberDef
 
 PyObject *
 PyFunction_NewWithQualName(PyObject *code, PyObject *globals, PyObject *qualname)
diff --git a/Objects/genericaliasobject.c b/Objects/genericaliasobject.c
index 49f537ef96845..b8ad4d7014b0c 100644
--- a/Objects/genericaliasobject.c
+++ b/Objects/genericaliasobject.c
@@ -2,7 +2,7 @@
 
 #include "Python.h"
 #include "pycore_object.h"
-#include "structmember.h"
+#include "structmember.h"         // PyMemberDef
 
 typedef struct {
     PyObject_HEAD
@@ -118,7 +118,7 @@ ga_repr(PyObject *self)
 
     _PyUnicodeWriter writer;
     _PyUnicodeWriter_Init(&writer);
-    
+
     if (ga_repr_item(&writer, alias->origin) < 0) {
         goto error;
     }
diff --git a/Objects/genobject.c b/Objects/genobject.c
index b1a749d140e82..66c6ccba0c490 100644
--- a/Objects/genobject.c
+++ b/Objects/genobject.c
@@ -1,11 +1,11 @@
 /* Generator object implementation */
 
 #include "Python.h"
-#include "pycore_ceval.h"     // _PyEval_EvalFrame()
+#include "pycore_ceval.h"         // _PyEval_EvalFrame()
 #include "pycore_object.h"
-#include "pycore_pystate.h"   // _PyThreadState_GET()
+#include "pycore_pystate.h"       // _PyThreadState_GET()
 #include "frameobject.h"
-#include "structmember.h"
+#include "structmember.h"         // PyMemberDef
 #include "opcode.h"
 
 static PyObject *gen_close(PyGenObject *, PyObject *);
diff --git a/Objects/methodobject.c b/Objects/methodobject.c
index 4b4927db82094..f483671316225 100644
--- a/Objects/methodobject.c
+++ b/Objects/methodobject.c
@@ -2,12 +2,12 @@
 /* Method object implementation */
 
 #include "Python.h"
-#include "pycore_ceval.h"     // _Py_EnterRecursiveCall()
+#include "pycore_ceval.h"         // _Py_EnterRecursiveCall()
 #include "pycore_object.h"
 #include "pycore_pyerrors.h"
 #include "pycore_pymem.h"
-#include "pycore_pystate.h"   // _PyThreadState_GET()
-#include "structmember.h"
+#include "pycore_pystate.h"       // _PyThreadState_GET()
+#include "structmember.h"         // PyMemberDef
 
 /* undefine macro trampoline to PyCFunction_NewEx */
 #undef PyCFunction_New
diff --git a/Objects/moduleobject.c b/Objects/moduleobject.c
index 499ce09ae6b5b..ee4ed97588e29 100644
--- a/Objects/moduleobject.c
+++ b/Objects/moduleobject.c
@@ -2,9 +2,9 @@
 /* Module object implementation */
 
 #include "Python.h"
-#include "pycore_interp.h"    // PyInterpreterState.importlib
-#include "pycore_pystate.h"   // _PyInterpreterState_GET()
-#include "structmember.h"
+#include "pycore_interp.h"        // PyInterpreterState.importlib
+#include "pycore_pystate.h"       // _PyInterpreterState_GET()
+#include "structmember.h"         // PyMemberDef
 
 static Py_ssize_t max_module_number;
 
diff --git a/Objects/namespaceobject.c b/Objects/namespaceobject.c
index a28b9e509fcfb..29141a81d71ec 100644
--- a/Objects/namespaceobject.c
+++ b/Objects/namespaceobject.c
@@ -1,7 +1,7 @@
 // namespace object implementation
 
 #include "Python.h"
-#include "structmember.h"
+#include "structmember.h"         // PyMemberDef
 
 
 typedef struct {
diff --git a/Objects/odictobject.c b/Objects/odictobject.c
index 2fcaa47876513..d5bf499575d09 100644
--- a/Objects/odictobject.c
+++ b/Objects/odictobject.c
@@ -466,7 +466,7 @@ Potential Optimizations
 
 #include "Python.h"
 #include "pycore_object.h"
-#include "structmember.h"
+#include <stddef.h>               // offsetof()
 #include "dict-common.h"
 #include <stddef.h>
 
diff --git a/Objects/rangeobject.c b/Objects/rangeobject.c
index 4bea8d78e12fa..751dbb9815d82 100644
--- a/Objects/rangeobject.c
+++ b/Objects/rangeobject.c
@@ -3,7 +3,7 @@
 #include "Python.h"
 #include "pycore_abstract.h"   // _PyIndex_Check()
 #include "pycore_tupleobject.h"
-#include "structmember.h"
+#include "structmember.h"         // PyMemberDef
 
 /* Support objects whose length is > PY_SSIZE_T_MAX.
 
diff --git a/Objects/setobject.c b/Objects/setobject.c
index 0b15bedeb4ff3..8452546008bd1 100644
--- a/Objects/setobject.c
+++ b/Objects/setobject.c
@@ -32,8 +32,8 @@
 */
 
 #include "Python.h"
-#include "pycore_object.h"   // _PyObject_GC_UNTRACK()
-#include "structmember.h"
+#include "pycore_object.h"        // _PyObject_GC_UNTRACK()
+#include <stddef.h>               // offsetof()
 
 /* Object used as dummy key to fill deleted entries */
 static PyObject _dummy_struct;
diff --git a/Objects/sliceobject.c b/Objects/sliceobject.c
index 0a5f00dbe0a39..6093b3bd1534d 100644
--- a/Objects/sliceobject.c
+++ b/Objects/sliceobject.c
@@ -14,10 +14,10 @@ this type and there is exactly one in existence.
 */
 
 #include "Python.h"
-#include "pycore_abstract.h"   // _PyIndex_Check()
+#include "pycore_abstract.h"      // _PyIndex_Check()
 #include "pycore_object.h"
 #include "pycore_pymem.h"
-#include "structmember.h"
+#include "structmember.h"         // PyMemberDef
 
 static PyObject *
 ellipsis_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
diff --git a/Objects/structseq.c b/Objects/structseq.c
index 1865e2461a2f4..9bdda87ae0be0 100644
--- a/Objects/structseq.c
+++ b/Objects/structseq.c
@@ -10,7 +10,7 @@
 #include "Python.h"
 #include "pycore_tupleobject.h"
 #include "pycore_object.h"
-#include "structmember.h"
+#include "structmember.h"         // PyMemberDef
 
 static const char visible_length_key[] = "n_sequence_fields";
 static const char real_length_key[] = "n_fields";
diff --git a/Objects/typeobject.c b/Objects/typeobject.c
index 47766bf6fbbbf..a107715808fff 100644
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -5,9 +5,9 @@
 #include "pycore_initconfig.h"
 #include "pycore_object.h"
 #include "pycore_pyerrors.h"
-#include "pycore_pystate.h"     // _PyThreadState_GET()
+#include "pycore_pystate.h"       // _PyThreadState_GET()
 #include "frameobject.h"
-#include "structmember.h"
+#include "structmember.h"         // PyMemberDef
 
 #include <ctype.h>
 
diff --git a/Objects/weakrefobject.c b/Objects/weakrefobject.c
index dd9b789823512..9640d93aaf2da 100644
--- a/Objects/weakrefobject.c
+++ b/Objects/weakrefobject.c
@@ -1,6 +1,6 @@
 #include "Python.h"
-#include "pycore_object.h"   // _PyObject_GET_WEAKREFS_LISTPTR
-#include "structmember.h"
+#include "pycore_object.h"        // _PyObject_GET_WEAKREFS_LISTPTR()
+#include "structmember.h"         // PyMemberDef
 
 
 #define GET_WEAKREFS_LISTPTR(o) \
diff --git a/PC/winreg.c b/PC/winreg.c
index ec2f607d4a818..3e13e75826f15 100644
--- a/PC/winreg.c
+++ b/PC/winreg.c
@@ -14,8 +14,8 @@
 
 #define PY_SSIZE_T_CLEAN
 #include "Python.h"
-#include "structmember.h"
-#include "windows.h"
+#include "structmember.h"         // PyMemberDef
+#include <windows.h>
 
 static BOOL PyHKEY_AsHKEY(PyObject *ob, HKEY *pRes, BOOL bNoneOK);
 static BOOL clinic_HKEY_converter(PyObject *ob, void *p);
diff --git a/Parser/asdl_c.py b/Parser/asdl_c.py
index bd22fb6bf73fe..c98f949042f30 100755
--- a/Parser/asdl_c.py
+++ b/Parser/asdl_c.py
@@ -1428,7 +1428,7 @@ def main(srcfile, dump_module=False):
             f.write('\n')
             f.write('#include "Python.h"\n')
             f.write('#include "%s-ast.h"\n' % mod.name)
-            f.write('#include "structmember.h"\n')
+            f.write('#include "structmember.h"         // PyMemberDef\n')
             f.write('\n')
 
             generate_module_def(f, mod)
diff --git a/Python/Python-ast.c b/Python/Python-ast.c
index 488276a455546..80f91646fd62e 100644
--- a/Python/Python-ast.c
+++ b/Python/Python-ast.c
@@ -4,7 +4,7 @@
 
 #include "Python.h"
 #include "Python-ast.h"
-#include "structmember.h"
+#include "structmember.h"         // PyMemberDef
 
 typedef struct {
     int initialized;
diff --git a/Python/ceval.c b/Python/ceval.c
index 5e54356719377..59765d850ba1d 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -29,7 +29,6 @@
 #include "opcode.h"
 #include "pydtrace.h"
 #include "setobject.h"
-#include "structmember.h"
 
 #include <ctype.h>
 
diff --git a/Python/context.c b/Python/context.c
index 15749e9fd7741..f0217f280180a 100644
--- a/Python/context.c
+++ b/Python/context.c
@@ -6,7 +6,7 @@
 #include "pycore_object.h"
 #include "pycore_pyerrors.h"
 #include "pycore_pystate.h"       // _PyThreadState_GET()
-#include "structmember.h"
+#include "structmember.h"         // PyMemberDef
 
 
 #define CONTEXT_FREELIST_MAXLEN 255
diff --git a/Python/hamt.c b/Python/hamt.c
index 9924e3351243e..8801c5ea418c7 100644
--- a/Python/hamt.c
+++ b/Python/hamt.c
@@ -1,8 +1,8 @@
 #include "Python.h"
 
 #include "pycore_hamt.h"
-#include "pycore_object.h"   // _PyObject_GC_TRACK()
-#include "structmember.h"
+#include "pycore_object.h"        // _PyObject_GC_TRACK()
+#include <stddef.h>               // offsetof()
 
 /*
 This file provides an implementation of an immutable mapping using the
diff --git a/Python/structmember.c b/Python/structmember.c
index e653d0277c1a1..ba88e15f93869 100644
--- a/Python/structmember.c
+++ b/Python/structmember.c
@@ -2,8 +2,7 @@
 /* Map C struct members to Python object attributes */
 
 #include "Python.h"
-
-#include "structmember.h"
+#include "structmember.h"         // PyMemberDef
 
 PyObject *
 PyMember_GetOne(const char *addr, PyMemberDef *l)
diff --git a/Python/symtable.c b/Python/symtable.c
index a3c5d650d1edc..d192f31deefb7 100644
--- a/Python/symtable.c
+++ b/Python/symtable.c
@@ -2,7 +2,7 @@
 #include "pycore_pystate.h"   // _PyThreadState_GET()
 #include "symtable.h"
 #undef Yield   /* undefine macro conflicting with <winbase.h> */
-#include "structmember.h"
+#include "structmember.h"         // PyMemberDef
 
 /* error strings used for warnings */
 #define GLOBAL_PARAM \
diff --git a/Python/traceback.c b/Python/traceback.c
index 610c2172ef833..e3397ecfe48f5 100644
--- a/Python/traceback.c
+++ b/Python/traceback.c
@@ -5,7 +5,7 @@
 
 #include "code.h"
 #include "frameobject.h"
-#include "structmember.h"
+#include "structmember.h"         // PyMemberDef
 #include "osdefs.h"
 #ifdef HAVE_FCNTL_H
 #include <fcntl.h>



More information about the Python-checkins mailing list