Skip to content

[mypyc] Add new type for expressing header dependencies#21223

Merged
p-sawicki merged 2 commits intopython:masterfrom
p-sawicki:header-dep-type
Apr 14, 2026
Merged

[mypyc] Add new type for expressing header dependencies#21223
p-sawicki merged 2 commits intopython:masterfrom
p-sawicki:header-dep-type

Conversation

@p-sawicki
Copy link
Copy Markdown
Collaborator

@p-sawicki p-sawicki commented Apr 14, 2026

Follow-up to #21183 to address a review comment. The external dependency of a capsule added there is really only needed to get the path of a lib-rt header that can be placed in the external header of a C extension so it doesn't make sense to use SourceDep that references a .c file. Instead add a new HeaderDep type that expresses only a dependency on a header file.

The header has to be included in the external C extension header because the exports table might reference types defined in lib-rt headers, like VecT in lib-rt/vecs/librt_vecs.h. However, the external C extension header cannot include the _api.h header added in that PR because that would leak a dependency on the associated _api.c file which defines extern objects declared in _api.h. That would result in undefined objects when a C extension that doesn't depend on a given lib-rt module (including indirectly) imports from a C extension that does.

@p-sawicki p-sawicki merged commit 8d58fce into python:master Apr 14, 2026
17 checks passed
@p-sawicki p-sawicki deleted the header-dep-type branch April 14, 2026 13:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants