diff options
author | Victor Stinner <vstinner@python.org> | 2023-08-31 21:42:34 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-31 21:42:34 (GMT) |
commit | ad73674283978a8bf8f1983bfd69150e60e6225f (patch) | |
tree | fa2e42b2a4cdfb24e5459194930db6b490e1eba8 /Objects/clinic | |
parent | 2bd960b57944107fbfbd8ff005b4223e1ea6555f (diff) | |
download | cpython-ad73674283978a8bf8f1983bfd69150e60e6225f.zip cpython-ad73674283978a8bf8f1983bfd69150e60e6225f.tar.gz cpython-ad73674283978a8bf8f1983bfd69150e60e6225f.tar.bz2 |
gh-107603: Argument Clinic: Only include pycore_gc.h if needed (#108726)
Argument Clinic now only includes pycore_gc.h if PyGC_Head is needed,
and only includes pycore_runtime.h if _Py_ID() is needed.
* Add 'condition' optional argument to Clinic.add_include().
* deprecate_keyword_use() includes pycore_runtime.h when using
the _PyID() function.
* Fix rendering of includes: comments start at the column 35.
* Mark PC/clinic/_wmimodule.cpp.h and
"Objects/stringlib/clinic/*.h.h" header files as generated in
.gitattributes.
Effects:
* 42 header files generated by AC no longer include the internal C
API, instead of 4 header files before. For example,
Modules/clinic/_abc.c.h no longer includes the internal C API.
* Fix _testclinic_depr.c.h: it now always includes pycore_runtime.h
to get _Py_ID().
Diffstat (limited to 'Objects/clinic')
-rw-r--r-- | Objects/clinic/bytearrayobject.c.h | 9 | ||||
-rw-r--r-- | Objects/clinic/bytesobject.c.h | 9 | ||||
-rw-r--r-- | Objects/clinic/classobject.c.h | 8 | ||||
-rw-r--r-- | Objects/clinic/codeobject.c.h | 7 | ||||
-rw-r--r-- | Objects/clinic/complexobject.c.h | 7 | ||||
-rw-r--r-- | Objects/clinic/descrobject.c.h | 7 | ||||
-rw-r--r-- | Objects/clinic/dictobject.c.h | 8 | ||||
-rw-r--r-- | Objects/clinic/enumobject.c.h | 7 | ||||
-rw-r--r-- | Objects/clinic/floatobject.c.h | 8 | ||||
-rw-r--r-- | Objects/clinic/funcobject.c.h | 7 | ||||
-rw-r--r-- | Objects/clinic/listobject.c.h | 9 | ||||
-rw-r--r-- | Objects/clinic/longobject.c.h | 9 | ||||
-rw-r--r-- | Objects/clinic/memoryobject.c.h | 7 | ||||
-rw-r--r-- | Objects/clinic/moduleobject.c.h | 7 | ||||
-rw-r--r-- | Objects/clinic/odictobject.c.h | 7 | ||||
-rw-r--r-- | Objects/clinic/structseq.c.h | 7 | ||||
-rw-r--r-- | Objects/clinic/tupleobject.c.h | 8 | ||||
-rw-r--r-- | Objects/clinic/typeobject.c.h | 8 | ||||
-rw-r--r-- | Objects/clinic/typevarobject.c.h | 7 | ||||
-rw-r--r-- | Objects/clinic/unicodeobject.c.h | 9 |
20 files changed, 55 insertions, 100 deletions
diff --git a/Objects/clinic/bytearrayobject.c.h b/Objects/clinic/bytearrayobject.c.h index f091fc7..7039db0 100644 --- a/Objects/clinic/bytearrayobject.c.h +++ b/Objects/clinic/bytearrayobject.c.h @@ -3,11 +3,10 @@ preserve [clinic start generated code]*/ #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) -# include "pycore_gc.h" // PyGC_Head -# include "pycore_runtime.h" // _Py_ID() +# include "pycore_gc.h" // PyGC_Head +# include "pycore_runtime.h" // _Py_ID() #endif - -#include "pycore_abstract.h" // _PyNumber_Index() +#include "pycore_abstract.h" // _PyNumber_Index() static int bytearray___init___impl(PyByteArrayObject *self, PyObject *arg, @@ -1285,4 +1284,4 @@ bytearray_sizeof(PyByteArrayObject *self, PyObject *Py_UNUSED(ignored)) { return bytearray_sizeof_impl(self); } -/*[clinic end generated code: output=d388e9027b333f00 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=94b9b5f492b5fed6 input=a9049054013a1b77]*/ diff --git a/Objects/clinic/bytesobject.c.h b/Objects/clinic/bytesobject.c.h index 66db76d..e2f9ba6 100644 --- a/Objects/clinic/bytesobject.c.h +++ b/Objects/clinic/bytesobject.c.h @@ -3,11 +3,10 @@ preserve [clinic start generated code]*/ #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) -# include "pycore_gc.h" // PyGC_Head -# include "pycore_runtime.h" // _Py_ID() +# include "pycore_gc.h" // PyGC_Head +# include "pycore_runtime.h" // _Py_ID() #endif - -#include "pycore_abstract.h" // _PyNumber_Index() +#include "pycore_abstract.h" // _PyNumber_Index() PyDoc_STRVAR(bytes___bytes____doc__, "__bytes__($self, /)\n" @@ -1061,4 +1060,4 @@ skip_optional_pos: exit: return return_value; } -/*[clinic end generated code: output=9da56b6c04914e18 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=8a9f5c28cbfe7592 input=a9049054013a1b77]*/ diff --git a/Objects/clinic/classobject.c.h b/Objects/clinic/classobject.c.h index a7bac63..48cfd6c 100644 --- a/Objects/clinic/classobject.c.h +++ b/Objects/clinic/classobject.c.h @@ -2,12 +2,6 @@ preserve [clinic start generated code]*/ -#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) -# include "pycore_gc.h" // PyGC_Head -# include "pycore_runtime.h" // _Py_ID() -#endif - - PyDoc_STRVAR(method___reduce____doc__, "__reduce__($self, /)\n" "--\n" @@ -86,4 +80,4 @@ instancemethod_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) exit: return return_value; } -/*[clinic end generated code: output=2a5e7fa5947a86cb input=a9049054013a1b77]*/ +/*[clinic end generated code: output=a0d17bad3b0734d9 input=a9049054013a1b77]*/ diff --git a/Objects/clinic/codeobject.c.h b/Objects/clinic/codeobject.c.h index 65801bd..b20b066 100644 --- a/Objects/clinic/codeobject.c.h +++ b/Objects/clinic/codeobject.c.h @@ -3,11 +3,10 @@ preserve [clinic start generated code]*/ #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) -# include "pycore_gc.h" // PyGC_Head -# include "pycore_runtime.h" // _Py_ID() +# include "pycore_gc.h" // PyGC_Head +# include "pycore_runtime.h" // _Py_ID() #endif - PyDoc_STRVAR(code_new__doc__, "code(argcount, posonlyargcount, kwonlyargcount, nlocals, stacksize,\n" " flags, codestring, constants, names, varnames, filename, name,\n" @@ -464,4 +463,4 @@ code__varname_from_oparg(PyCodeObject *self, PyObject *const *args, Py_ssize_t n exit: return return_value; } -/*[clinic end generated code: output=0446968a1fbd13b2 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=b9ccfbfabe1a5f46 input=a9049054013a1b77]*/ diff --git a/Objects/clinic/complexobject.c.h b/Objects/clinic/complexobject.c.h index bb2b381..788f30d 100644 --- a/Objects/clinic/complexobject.c.h +++ b/Objects/clinic/complexobject.c.h @@ -3,11 +3,10 @@ preserve [clinic start generated code]*/ #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) -# include "pycore_gc.h" // PyGC_Head -# include "pycore_runtime.h" // _Py_ID() +# include "pycore_gc.h" // PyGC_Head +# include "pycore_runtime.h" // _Py_ID() #endif - PyDoc_STRVAR(complex_conjugate__doc__, "conjugate($self, /)\n" "--\n" @@ -157,4 +156,4 @@ skip_optional_pos: exit: return return_value; } -/*[clinic end generated code: output=d438b7ed87f8459e input=a9049054013a1b77]*/ +/*[clinic end generated code: output=002c74f8a33b6697 input=a9049054013a1b77]*/ diff --git a/Objects/clinic/descrobject.c.h b/Objects/clinic/descrobject.c.h index 7570643..4f18fd7 100644 --- a/Objects/clinic/descrobject.c.h +++ b/Objects/clinic/descrobject.c.h @@ -3,11 +3,10 @@ preserve [clinic start generated code]*/ #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) -# include "pycore_gc.h" // PyGC_Head -# include "pycore_runtime.h" // _Py_ID() +# include "pycore_gc.h" // PyGC_Head +# include "pycore_runtime.h" // _Py_ID() #endif - static PyObject * mappingproxy_new_impl(PyTypeObject *type, PyObject *mapping); @@ -167,4 +166,4 @@ skip_optional_pos: exit: return return_value; } -/*[clinic end generated code: output=8dc1ddfcf764ac8e input=a9049054013a1b77]*/ +/*[clinic end generated code: output=a97dc44d12f9f9b6 input=a9049054013a1b77]*/ diff --git a/Objects/clinic/dictobject.c.h b/Objects/clinic/dictobject.c.h index bc24523..eda86c3 100644 --- a/Objects/clinic/dictobject.c.h +++ b/Objects/clinic/dictobject.c.h @@ -2,12 +2,6 @@ preserve [clinic start generated code]*/ -#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) -# include "pycore_gc.h" // PyGC_Head -# include "pycore_runtime.h" // _Py_ID() -#endif - - PyDoc_STRVAR(dict_fromkeys__doc__, "fromkeys($type, iterable, value=None, /)\n" "--\n" @@ -197,4 +191,4 @@ dict___reversed__(PyDictObject *self, PyObject *Py_UNUSED(ignored)) { return dict___reversed___impl(self); } -/*[clinic end generated code: output=c0064abbea6091c5 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=582766ac0154c8bf input=a9049054013a1b77]*/ diff --git a/Objects/clinic/enumobject.c.h b/Objects/clinic/enumobject.c.h index adf78ef..97f20c6 100644 --- a/Objects/clinic/enumobject.c.h +++ b/Objects/clinic/enumobject.c.h @@ -3,11 +3,10 @@ preserve [clinic start generated code]*/ #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) -# include "pycore_gc.h" // PyGC_Head -# include "pycore_runtime.h" // _Py_ID() +# include "pycore_gc.h" // PyGC_Head +# include "pycore_runtime.h" // _Py_ID() #endif - PyDoc_STRVAR(enum_new__doc__, "enumerate(iterable, start=0)\n" "--\n" @@ -107,4 +106,4 @@ reversed_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) exit: return return_value; } -/*[clinic end generated code: output=aba0ddbeab1601e3 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=661b29708f501d19 input=a9049054013a1b77]*/ diff --git a/Objects/clinic/floatobject.c.h b/Objects/clinic/floatobject.c.h index 3d9cd3a..c40eff8 100644 --- a/Objects/clinic/floatobject.c.h +++ b/Objects/clinic/floatobject.c.h @@ -2,12 +2,6 @@ preserve [clinic start generated code]*/ -#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) -# include "pycore_gc.h" // PyGC_Head -# include "pycore_runtime.h" // _Py_ID() -#endif - - PyDoc_STRVAR(float_is_integer__doc__, "is_integer($self, /)\n" "--\n" @@ -322,4 +316,4 @@ float___format__(PyObject *self, PyObject *arg) exit: return return_value; } -/*[clinic end generated code: output=355c3f5102034a41 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=eb093cc601cc5426 input=a9049054013a1b77]*/ diff --git a/Objects/clinic/funcobject.c.h b/Objects/clinic/funcobject.c.h index c3a3a8e..1be4567 100644 --- a/Objects/clinic/funcobject.c.h +++ b/Objects/clinic/funcobject.c.h @@ -3,11 +3,10 @@ preserve [clinic start generated code]*/ #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) -# include "pycore_gc.h" // PyGC_Head -# include "pycore_runtime.h" // _Py_ID() +# include "pycore_gc.h" // PyGC_Head +# include "pycore_runtime.h" // _Py_ID() #endif - PyDoc_STRVAR(func_new__doc__, "function(code, globals, name=None, argdefs=None, closure=None)\n" "--\n" @@ -104,4 +103,4 @@ skip_optional_pos: exit: return return_value; } -/*[clinic end generated code: output=777cead7b1f6fad3 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=b2d676ff51c992d0 input=a9049054013a1b77]*/ diff --git a/Objects/clinic/listobject.c.h b/Objects/clinic/listobject.c.h index a41ed3e..b6f0c5c 100644 --- a/Objects/clinic/listobject.c.h +++ b/Objects/clinic/listobject.c.h @@ -3,11 +3,10 @@ preserve [clinic start generated code]*/ #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) -# include "pycore_gc.h" // PyGC_Head -# include "pycore_runtime.h" // _Py_ID() +# include "pycore_gc.h" // PyGC_Head +# include "pycore_runtime.h" // _Py_ID() #endif - -#include "pycore_abstract.h" // _PyNumber_Index() +#include "pycore_abstract.h" // _PyNumber_Index() PyDoc_STRVAR(list_insert__doc__, "insert($self, index, object, /)\n" @@ -384,4 +383,4 @@ list___reversed__(PyListObject *self, PyObject *Py_UNUSED(ignored)) { return list___reversed___impl(self); } -/*[clinic end generated code: output=537a17b562c57505 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=e2d9f4092498a5ca input=a9049054013a1b77]*/ diff --git a/Objects/clinic/longobject.c.h b/Objects/clinic/longobject.c.h index 3ecef1f..9288648 100644 --- a/Objects/clinic/longobject.c.h +++ b/Objects/clinic/longobject.c.h @@ -3,11 +3,10 @@ preserve [clinic start generated code]*/ #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) -# include "pycore_gc.h" // PyGC_Head -# include "pycore_runtime.h" // _Py_ID() +# include "pycore_gc.h" // PyGC_Head +# include "pycore_runtime.h" // _Py_ID() #endif - -#include "pycore_abstract.h" // _PyNumber_Index() +#include "pycore_abstract.h" // _PyNumber_Index() static PyObject * long_new_impl(PyTypeObject *type, PyObject *x, PyObject *obase); @@ -476,4 +475,4 @@ int_is_integer(PyObject *self, PyObject *Py_UNUSED(ignored)) { return int_is_integer_impl(self); } -/*[clinic end generated code: output=ea9c87ea532dadbe input=a9049054013a1b77]*/ +/*[clinic end generated code: output=009a537ab558763c input=a9049054013a1b77]*/ diff --git a/Objects/clinic/memoryobject.c.h b/Objects/clinic/memoryobject.c.h index a6561e2..74c749e 100644 --- a/Objects/clinic/memoryobject.c.h +++ b/Objects/clinic/memoryobject.c.h @@ -3,11 +3,10 @@ preserve [clinic start generated code]*/ #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) -# include "pycore_gc.h" // PyGC_Head -# include "pycore_runtime.h" // _Py_ID() +# include "pycore_gc.h" // PyGC_Head +# include "pycore_runtime.h" // _Py_ID() #endif - PyDoc_STRVAR(memoryview__doc__, "memoryview(object)\n" "--\n" @@ -413,4 +412,4 @@ skip_optional_pos: exit: return return_value; } -/*[clinic end generated code: output=28a632db32b44b63 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=7ebdadda3b0fcd35 input=a9049054013a1b77]*/ diff --git a/Objects/clinic/moduleobject.c.h b/Objects/clinic/moduleobject.c.h index 29df388..ce21e47 100644 --- a/Objects/clinic/moduleobject.c.h +++ b/Objects/clinic/moduleobject.c.h @@ -3,11 +3,10 @@ preserve [clinic start generated code]*/ #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) -# include "pycore_gc.h" // PyGC_Head -# include "pycore_runtime.h" // _Py_ID() +# include "pycore_gc.h" // PyGC_Head +# include "pycore_runtime.h" // _Py_ID() #endif - PyDoc_STRVAR(module___init____doc__, "module(name, doc=None)\n" "--\n" @@ -74,4 +73,4 @@ skip_optional_pos: exit: return return_value; } -/*[clinic end generated code: output=a5a750cc8190576e input=a9049054013a1b77]*/ +/*[clinic end generated code: output=9d3d7854d17a033c input=a9049054013a1b77]*/ diff --git a/Objects/clinic/odictobject.c.h b/Objects/clinic/odictobject.c.h index 115a134..643f504 100644 --- a/Objects/clinic/odictobject.c.h +++ b/Objects/clinic/odictobject.c.h @@ -3,11 +3,10 @@ preserve [clinic start generated code]*/ #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) -# include "pycore_gc.h" // PyGC_Head -# include "pycore_runtime.h" // _Py_ID() +# include "pycore_gc.h" // PyGC_Head +# include "pycore_runtime.h" // _Py_ID() #endif - PyDoc_STRVAR(OrderedDict_fromkeys__doc__, "fromkeys($type, /, iterable, value=None)\n" "--\n" @@ -332,4 +331,4 @@ skip_optional_pos: exit: return return_value; } -/*[clinic end generated code: output=76d85a9162d62ca8 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=6d7ae9fb552c6108 input=a9049054013a1b77]*/ diff --git a/Objects/clinic/structseq.c.h b/Objects/clinic/structseq.c.h index 40ba18a..2571888 100644 --- a/Objects/clinic/structseq.c.h +++ b/Objects/clinic/structseq.c.h @@ -3,11 +3,10 @@ preserve [clinic start generated code]*/ #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) -# include "pycore_gc.h" // PyGC_Head -# include "pycore_runtime.h" // _Py_ID() +# include "pycore_gc.h" // PyGC_Head +# include "pycore_runtime.h" // _Py_ID() #endif - static PyObject * structseq_new_impl(PyTypeObject *type, PyObject *arg, PyObject *dict); @@ -62,4 +61,4 @@ skip_optional_pos: exit: return return_value; } -/*[clinic end generated code: output=802d5663c7d01024 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=2f88fe2a6f5c13a8 input=a9049054013a1b77]*/ diff --git a/Objects/clinic/tupleobject.c.h b/Objects/clinic/tupleobject.c.h index 3de9575..f217127 100644 --- a/Objects/clinic/tupleobject.c.h +++ b/Objects/clinic/tupleobject.c.h @@ -2,12 +2,6 @@ preserve [clinic start generated code]*/ -#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) -# include "pycore_gc.h" // PyGC_Head -# include "pycore_runtime.h" // _Py_ID() -#endif - - PyDoc_STRVAR(tuple_index__doc__, "index($self, value, start=0, stop=sys.maxsize, /)\n" "--\n" @@ -118,4 +112,4 @@ tuple___getnewargs__(PyTupleObject *self, PyObject *Py_UNUSED(ignored)) { return tuple___getnewargs___impl(self); } -/*[clinic end generated code: output=48a9e0834b300ac3 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=7c5d9d12e0cf6a83 input=a9049054013a1b77]*/ diff --git a/Objects/clinic/typeobject.c.h b/Objects/clinic/typeobject.c.h index 1857eab..eb0b22a 100644 --- a/Objects/clinic/typeobject.c.h +++ b/Objects/clinic/typeobject.c.h @@ -2,12 +2,6 @@ preserve [clinic start generated code]*/ -#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) -# include "pycore_gc.h" // PyGC_Head -# include "pycore_runtime.h" // _Py_ID() -#endif - - PyDoc_STRVAR(type___instancecheck____doc__, "__instancecheck__($self, instance, /)\n" "--\n" @@ -266,4 +260,4 @@ object___dir__(PyObject *self, PyObject *Py_UNUSED(ignored)) { return object___dir___impl(self); } -/*[clinic end generated code: output=baf5ec2093815a3f input=a9049054013a1b77]*/ +/*[clinic end generated code: output=943f639f264362d9 input=a9049054013a1b77]*/ diff --git a/Objects/clinic/typevarobject.c.h b/Objects/clinic/typevarobject.c.h index 5d12be5..4762cd6 100644 --- a/Objects/clinic/typevarobject.c.h +++ b/Objects/clinic/typevarobject.c.h @@ -3,11 +3,10 @@ preserve [clinic start generated code]*/ #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) -# include "pycore_gc.h" // PyGC_Head -# include "pycore_runtime.h" // _Py_ID() +# include "pycore_gc.h" // PyGC_Head +# include "pycore_runtime.h" // _Py_ID() #endif - PyDoc_STRVAR(typevar_new__doc__, "typevar(name, *constraints, *, bound=None, covariant=False,\n" " contravariant=False, infer_variance=False)\n" @@ -591,4 +590,4 @@ skip_optional_kwonly: exit: return return_value; } -/*[clinic end generated code: output=d614edf64f28e346 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=db0b327ebbb1488f input=a9049054013a1b77]*/ diff --git a/Objects/clinic/unicodeobject.c.h b/Objects/clinic/unicodeobject.c.h index 56b6408..cfee9b8 100644 --- a/Objects/clinic/unicodeobject.c.h +++ b/Objects/clinic/unicodeobject.c.h @@ -3,11 +3,10 @@ preserve [clinic start generated code]*/ #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) -# include "pycore_gc.h" // PyGC_Head -# include "pycore_runtime.h" // _Py_ID() +# include "pycore_gc.h" // PyGC_Head +# include "pycore_runtime.h" // _Py_ID() #endif - -#include "pycore_abstract.h" // _PyNumber_Index() +#include "pycore_abstract.h" // _PyNumber_Index() PyDoc_STRVAR(EncodingMap_size__doc__, "size($self, /)\n" @@ -1505,4 +1504,4 @@ skip_optional_pos: exit: return return_value; } -/*[clinic end generated code: output=a64776a3ea1c970c input=a9049054013a1b77]*/ +/*[clinic end generated code: output=8d08dfbb814c4393 input=a9049054013a1b77]*/ |