Repository navigation
Argument Clinic includes internal headers in generated output unconditionally #107603
Description
Activity
- addedtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
on Aug 3, 2023 'unconditionally' was a bit harsh, but it does generate core includes for some cases where it is not needed.
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.
Yeah, it's not an important issue. But/feature? I'd say it is an undesirable feature, then :)
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.
- added a commit that references this issue
on Aug 28, 2023 - added 11 commits that reference this issue
on Aug 31, 2023 Is there more to do for this, or can the issue be closed?
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 thePy_LIMITED_APImacro.Argument Clinic now generates
#includefor 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, nopycore_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.
Reacted by Hugo van Kemenade
It seems like Argument Clinic generates code that define
Py_BUILD_COREand includes internal headers unconditionally; for example, a file with aMETH_Ofunction will have no need for those:Details
OTOH, a
METH_KEYWORDSfunction needs those:Details
Argument Clinic should check if those defines/includes are needed before generating the output.
Linked PRs
print_block()#108581