forked from scipy/scipy
-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CI: Add a check that Python.h is included first in any file using Python features. #5
Open
DWesl
wants to merge
142
commits into
main
Choose a base branch
from
patch-4
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains 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
BLD: Accelerate builds should not define `NO_APPEND_FORTRAN`
Based on script from scipy#20149. Doesn't know about Boost::Python yet. DEV: Print name of file check_python_h_first is checking DEV: Add numpy/ndarrayobject.h to list of Python-including headers One file includes this first.
BLD: Move python-including file earlier in io/_fast_matrix_market/src/_fmm_core.cpp BLD: Move stdlib header after python-including headers in optimize/_pava/pava_pybind.cpp BLD:BUG: Move python-including file to top of special/_special_ufuncs.cpp DEV: Move python-including file earlier in wrap_g77_abi.c Wasn't actually a problem, but this makes it easier for my script to check. DEV: Move python including file earlier in wrap_dummy_g77_abi.c Not actually a problem, but this makes it easier for my script to check. STY: Remove duplicate headers at start of special/sf_error.cc
Hopefully this reduces false-positives.
It does include python first, and this will note that.
The file including the header should have already included Python.h (and whatever file for the specific constructs, or the compilation would fail everywhere)
This can cause errors if the header has no guard, or just slow things a bit if it does have a guard. CI: Exclude boost_math and highs from header check. Entirely too many false positives. CI: Don't check fast_float It seems to be a bunch of headers concatenated, which naturally results in many duplicate includes.
This reverts commit bd118fa.
Not sure what `re.compile` is doing before the matching that takes as long as the regex
Also add cxx/hxx extensions, and handle the resulting new false positives.
These got found by the new file types.
[skip ci] Co-authored-by: DWesl <[email protected]>
[skip cirrus] [skip circle]
[skip circle] [skip cirrus] Co-authored-by: DWesl <[email protected]>
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.
Reference issue
Builds from the script in scipy#20149
What does this implement/fix?
Python extensions require Python.h be included first.
Practically speaking, including other headers first will usually result in the visibility macros being set to other values, such that various macros and functions don't get defined and break things later.
This attempts to catch those errors before they cause problems.
Additional information
The script still doesn't know about Boost::Python. Hopefully that's not actually used.