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 /Modules/_testcapi | |
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 'Modules/_testcapi')
-rw-r--r-- | Modules/_testcapi/clinic/exceptions.c.h | 7 | ||||
-rw-r--r-- | Modules/_testcapi/clinic/float.c.h | 8 | ||||
-rw-r--r-- | Modules/_testcapi/clinic/long.c.h | 8 | ||||
-rw-r--r-- | Modules/_testcapi/clinic/vectorcall.c.h | 8 | ||||
-rw-r--r-- | Modules/_testcapi/clinic/watchers.c.h | 8 |
5 files changed, 7 insertions, 32 deletions
diff --git a/Modules/_testcapi/clinic/exceptions.c.h b/Modules/_testcapi/clinic/exceptions.c.h index 61a9103..0188153 100644 --- a/Modules/_testcapi/clinic/exceptions.c.h +++ b/Modules/_testcapi/clinic/exceptions.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(_testcapi_err_set_raised__doc__, "err_set_raised($module, exception, /)\n" "--\n" @@ -488,4 +487,4 @@ _testcapi_unstable_exc_prep_reraise_star(PyObject *module, PyObject *const *args exit: return return_value; } -/*[clinic end generated code: output=6c4b7ad1cb1e0153 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=8f273949da28ffb5 input=a9049054013a1b77]*/ diff --git a/Modules/_testcapi/clinic/float.c.h b/Modules/_testcapi/clinic/float.c.h index 84de17a..fb0931a 100644 --- a/Modules/_testcapi/clinic/float.c.h +++ b/Modules/_testcapi/clinic/float.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(_testcapi_float_pack__doc__, "float_pack($module, size, d, le, /)\n" "--\n" @@ -85,4 +79,4 @@ _testcapi_float_unpack(PyObject *module, PyObject *const *args, Py_ssize_t nargs exit: return return_value; } -/*[clinic end generated code: output=de6879d0f4987d79 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=50146051f1341cce input=a9049054013a1b77]*/ diff --git a/Modules/_testcapi/clinic/long.c.h b/Modules/_testcapi/clinic/long.c.h index 87bba4c..b77cb51 100644 --- a/Modules/_testcapi/clinic/long.c.h +++ b/Modules/_testcapi/clinic/long.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(_testcapi_test_long_api__doc__, "test_long_api($module, /)\n" "--\n" @@ -171,4 +165,4 @@ PyDoc_STRVAR(_testcapi_PyLong_AsInt__doc__, #define _TESTCAPI_PYLONG_ASINT_METHODDEF \ {"PyLong_AsInt", (PyCFunction)_testcapi_PyLong_AsInt, METH_O, _testcapi_PyLong_AsInt__doc__}, -/*[clinic end generated code: output=1631a18f1193486a input=a9049054013a1b77]*/ +/*[clinic end generated code: output=31267ab2dd90aa1d input=a9049054013a1b77]*/ diff --git a/Modules/_testcapi/clinic/vectorcall.c.h b/Modules/_testcapi/clinic/vectorcall.c.h index 728c0d3..48688e9 100644 --- a/Modules/_testcapi/clinic/vectorcall.c.h +++ b/Modules/_testcapi/clinic/vectorcall.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(_testcapi_pyobject_fastcalldict__doc__, "pyobject_fastcalldict($module, func, func_args, kwargs, /)\n" "--\n" @@ -210,4 +204,4 @@ _testcapi_has_vectorcall_flag(PyObject *module, PyObject *arg) exit: return return_value; } -/*[clinic end generated code: output=beaf6beac3d13c25 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=0667266b825ec9ec input=a9049054013a1b77]*/ diff --git a/Modules/_testcapi/clinic/watchers.c.h b/Modules/_testcapi/clinic/watchers.c.h index ce9c770..fd2ef60 100644 --- a/Modules/_testcapi/clinic/watchers.c.h +++ b/Modules/_testcapi/clinic/watchers.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(_testcapi_watch_dict__doc__, "watch_dict($module, watcher_id, dict, /)\n" "--\n" @@ -195,4 +189,4 @@ _testcapi_set_func_kwdefaults_via_capi(PyObject *module, PyObject *const *args, exit: return return_value; } -/*[clinic end generated code: output=b7564a84c5815b46 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=5ad5771d6b29dfb9 input=a9049054013a1b77]*/ |