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 /Objects | |
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 'Objects')
-rw-r--r-- | Objects/abstract.c | 8 | ||||
-rw-r--r-- | Objects/bytearrayobject.c | 3 | ||||
-rw-r--r-- | Objects/classobject.c | 4 | ||||
-rw-r--r-- | Objects/codeobject.c | 2 | ||||
-rw-r--r-- | Objects/complexobject.c | 2 | ||||
-rw-r--r-- | Objects/descrobject.c | 2 | ||||
-rw-r--r-- | Objects/exceptions.c | 2 | ||||
-rw-r--r-- | Objects/frameobject.c | 2 | ||||
-rw-r--r-- | Objects/funcobject.c | 2 | ||||
-rw-r--r-- | Objects/genericaliasobject.c | 4 | ||||
-rw-r--r-- | Objects/genobject.c | 6 | ||||
-rw-r--r-- | Objects/methodobject.c | 6 | ||||
-rw-r--r-- | Objects/moduleobject.c | 6 | ||||
-rw-r--r-- | Objects/namespaceobject.c | 2 | ||||
-rw-r--r-- | Objects/odictobject.c | 2 | ||||
-rw-r--r-- | Objects/rangeobject.c | 2 | ||||
-rw-r--r-- | Objects/setobject.c | 4 | ||||
-rw-r--r-- | Objects/sliceobject.c | 4 | ||||
-rw-r--r-- | Objects/structseq.c | 2 | ||||
-rw-r--r-- | Objects/typeobject.c | 4 | ||||
-rw-r--r-- | Objects/weakrefobject.c | 4 |
21 files changed, 36 insertions, 37 deletions
diff --git a/Objects/abstract.c b/Objects/abstract.c index 8e22dfe..6e390dd 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 4d1ddec..f05a98a 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 ce4bf7b..242a642 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 da04af4..7376359 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 8d1461b..a490377 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 fe7ba79..572baa5 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 cb661f8..db1ff32 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 3c140ac..bdd7862 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 af6766f..750c7ae 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 49f537e..b8ad4d7 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 b1a749d..66c6ccb 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 4b4927d..f483671 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 499ce09a..ee4ed97 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 a28b9e5..29141a8 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 2fcaa47..d5bf499 100644 --- a/Objects/odictobject.c +++ b/Objects/odictobject.c @@ -466,7 +466,7 @@ later: #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 4bea8d7..751dbb9 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 0b15bed..8452546 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 0a5f00d..6093b3b 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 1865e24..9bdda87 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 47766bf..a107715 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 dd9b789..9640d93 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) \ |