-
-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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
BUG: Include Python.h before system headers. #20505
Conversation
cc @alugowski |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Glancing at the includes at the top of fast_matrix_market/types.hpp
this seems obviously correct since https://docs.python.org/3/c-api/intro.html#include-files clearly notes:
Since Python may define some pre-processor definitions which affect the standard headers on some systems, you must include Python.h before any standard headers are included.
Since the author of this C++ source actively helps us and has been pinged I'll leave it open for a bit.
Found a few more trying to get everything built on Cygwin. |
DWesl#5 has a script to check for this and sets up a CI job to do so. I've dropped the most likely false positives, leaving one instance in highspy that has since been removed in the upstream repository. Should I add those changes to this PR, replace this PR with that one (possibly after telling it to ignore highspy), squash-merge that PR onto the branch for this one, or something else? This includes all changes DWesl#7 needed to get SciPy installed and most tests passing on the 1.13 branch. |
Just bumped into this recently: clang-format reorders the includes, and puts Python.h somewhere in the middle. At least with the .clang-format file from scope/special/special |
Yep, unless there is a line break between |
….cpp Also include complex, since it's used and isn't already
Something is still unhappy:
|
The recent trend seems to be toward |
Yes, that's correct. I don't know where ufunc.h is getting included twice, but if putting |
It was |
NumPy .clang-format deals with putting the includes in the correct order. It is messy. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM and CI is all green now - in it goes. Thanks @DWesl & reviewers.
Reference issue
Closes #20491
What does this implement/fix?
Python.h needs to be included before any system header:
_fmm_core.hpp
does, but is not first.Additional information
The script from #20149 would not catch this. I might need to add
pybind11::
to the regex.