It seems like Argument Clinic generates code that define Py_BUILD_CORE and includes internal headers unconditionally; for example, a file with a METH_O function will have no need for those:
I don't think this is an important issue, this is more of a "nice to have" rather than necessary, it will probably add more conditional code. I certainly don't consider this as a bug though.
I don't think this is an important issue, this is more of a "nice to have" rather than necessary, it will probably add more conditional code. I certainly don't consider this as a bug though.
I would like this feature to be able to remove private functions only used by AC from the public C API: issue #106320.
There might be room for improvement: the #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) code is still generated for C code which doesn't define the Py_LIMITED_API macro.
Argument Clinic now generates #include for needed symbols. IMO the situation is less bad than before. Moreover, Argument Clinic now supports the limited C API: when targeting the limited C API, no pycore_ internal header is included, and so the problem is solved for these extensions.
While there is room for improvement, I close the issue: further changes can be done in a even more specific issue.
Activity
erlend-aasland commented on Aug 3, 2023
'unconditionally' was a bit harsh, but it does generate core includes for some cases where it is not needed.
kumaraditya303 commented on Aug 5, 2023
I don't think this is an important issue, this is more of a "nice to have" rather than necessary, it will probably add more conditional code. I certainly don't consider this as a bug though.
erlend-aasland commented on Aug 5, 2023
Yeah, it's not an important issue. But/feature? I'd say it is an undesirable feature, then :)
pythongh-107603: Argument Clinic can emit includes
pythongh-107603: Argument Clinic can emit includes
vstinner commented on Aug 25, 2023
I would like this feature to be able to remove private functions only used by AC from the public C API: issue #106320.
pythongh-107603: Argument Clinic can emit includes
gh-107603: Argument Clinic can emit includes (#108486)
GH-107603: Clinic: Pass specific attributes to ``print_block()`` (#10…
pythongh-107603: AC only includes pycore_gc.h if needed
pythongh-107603: AC only includes pycore_gc.h if needed
pythongh-107603: AC only includes pycore_gc.h if needed
pythongh-107603: AC only includes pycore_gc.h if needed
pythongh-107603: AC only includes pycore_gc.h if needed
pythongh-107603: AC only includes pycore_gc.h if needed
pythongh-107603: AC only includes pycore_gc.h if needed
pythongh-107603: AC only includes pycore_gc.h if needed
pythongh-107603: AC only includes pycore_gc.h if needed
pythongh-107603: AC only includes pycore_gc.h if needed
gh-107603: Argument Clinic: Only include pycore_gc.h if needed (#108726)
hugovk commented on Nov 9, 2023
Is there more to do for this, or can the issue be closed?
vstinner commented on Nov 9, 2023
There might be room for improvement: the #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) code is still generated for C code which doesn't define the Py_LIMITED_API macro.
Argument Clinic now generates #include for needed symbols. IMO the situation is less bad than before. Moreover, Argument Clinic now supports the limited C API: when targeting the limited C API, no pycore_ internal header is included, and so the problem is solved for these extensions.
While there is room for improvement, I close the issue: further changes can be done in a even more specific issue.