diff options
author | Victor Stinner <vstinner@python.org> | 2020-04-15 00:35:41 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-15 00:35:41 (GMT) |
commit | 4a21e57fe55076c77b0ee454e1994ca544d09dc0 (patch) | |
tree | 1c9ed1c1a467357a470cd37b98e20aa5b9878cf9 /Modules | |
parent | 62183b8d6d49e59c6a98bbdaa65b7ea1415abb7f (diff) | |
download | cpython-4a21e57fe55076c77b0ee454e1994ca544d09dc0.zip cpython-4a21e57fe55076c77b0ee454e1994ca544d09dc0.tar.gz cpython-4a21e57fe55076c77b0ee454e1994ca544d09dc0.tar.bz2 |
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.
Diffstat (limited to 'Modules')
48 files changed, 53 insertions, 62 deletions
diff --git a/Modules/_abc.c b/Modules/_abc.c index 1efc98b..7c040ef 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 c10866a..96a99fe 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 d46f96c..880632c 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 181e322..978ea03 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 950b0d7..3a52632 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 5548c50..ceae67e 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 815fc66..5c1ecab 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 f7c1b69..9bdc52e 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 99f1236..20ba8fb 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 03ac6b6..2c92a8a 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 d9536bb..90e388c 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@FreeBSD.org> diff --git a/Modules/_hashopenssl.c b/Modules/_hashopenssl.c index 1782636..0919cd3 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 571f225..d7cadac 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 f243ac8..f8e21f2 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 f4261b3..2468f45 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 1855b83..caf91df 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 924ffb5..a8e55c3 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 9feb76e..e76152e 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 9e33c1e..1abc9ca 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 94760ac..a83ef37 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 1754416..075aa3d 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 eac36b2..2a62a68 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 2049dbb..436ac6d 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 4b46c1f..d07fa53 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 062102e..b155ea9 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 87a9f41..958be7d 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 bb0d19f..3b2d7f4 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 836d796..244e4f1 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 e98359a..78c0676 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 82ac0a1..13d8072 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 8a76a3b..8e18b14 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 6e7ee0f..b3d90b2 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 5dc50fb..1b28adb 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 95ee5f8..4920ad7 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 319dc52..8640276 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 4ebeb74..18fcebd 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@rcn.com> diff --git a/Modules/mmapmodule.c b/Modules/mmapmodule.c index a1267bd..6c503b3 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 0711d51..2a1ac10 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 e8029e7..a16797c 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 7ac7484..f5beb09 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 d930e3e..12ae66d 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 1d09adc..5c15e99 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 eee582c..7310826 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 b2e0727..38d303d 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 2be0c10..9db8535 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 569e785..8a1198a 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 031005d..7200337 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 c2900a1..fe27909 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" |