Separate type/constant declarations from functions in C headers#15760
Merged
Conversation
Collaborator
|
One or more of the following people are relevant to this code:
|
400b4fa to
dd22bbe
Compare
This was referenced Mar 5, 2026
mrossinek
reviewed
Mar 6, 2026
When importing the C header files in Python extension-module mode, we will need to generate the function definitions in a completely different manner to regular function prototypes resolved at link time. This separates off the definitions of types and constants (which are shared) from functions (which are not), so that a later patch can add the alternate form.
dd22bbe to
374cd77
Compare
raynelfss
reviewed
Mar 11, 2026
Cryoris
reviewed
Mar 12, 2026
Cryoris
left a comment
Contributor
There was a problem hiding this comment.
This looks good and I'm happy to merge with the open questions addressed 🙂
Co-authored-by: Max Rossmannek <rmax@ethz.ch> Co-authored-by: Julien Gacon <gaconju@gmail.com>
mrossinek
previously approved these changes
Mar 17, 2026
mrossinek
left a comment
Member
There was a problem hiding this comment.
This looks good to me!
The only open thread is around updating the comments/documentation around funcs_py.h which I'm willing to accept as is, too. Being only a comment, it can also always be updated later on.
mrossinek
reviewed
Mar 17, 2026
| // The top-level `qiskit.h` defines all the C API functions in a different manner if | ||
| // `QISKIT_PYTHON_EXTENSION` is defined. In Python-aware builds/distributions of the C API, this | ||
| // file is replaced by one that is safe to use in those situations. We leave this file in place | ||
| // with an explicit stub to provide a better explanations to users who have a version of the C API |
Member
There was a problem hiding this comment.
Suggested change
| // with an explicit stub to provide a better explanations to users who have a version of the C API | |
| // with an explicit stub to provide a better explanation to users who have a version of the C API |
Either this or remove the a
Contributor
There was a problem hiding this comment.
Ah good catch -- maybe Jake can just add this to one of the follow up PRs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When importing the C header files in Python extension-module mode, we will need to generate the function definitions in a completely different manner to regular function prototypes resolved at link time. This separates off the definitions of types and constants (which are shared) from functions (which are not), so that a later patch can add the alternate form.
Depends on:
qiskit.capimodule #15711