-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
BLD,Cygwin: Include Python.h first in various C++ files #27821
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
Conversation
Python.h needs to be included before any system includes. This is easiest if it is the first include. Interestingly, pybind11/pybind11.h does not include Python, possibly depending on downstream projects including Python.h beforehand.
Needs to be included before system headers to set visibility macros for pybind11
pybind11 assumes Python.h is included first.
Checked all files instead of going one-by-one using check_python_h_first.py adapted from scipy/scipy#18049. |
Cygwin pytest recently updated, and only installs pytest-3.9
Cygwin pytest only installs pytest-3.9. I should possibly suggest using alternatives for that and pip.
I think we should just consider |
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.
Remove Python.h
includes immediately preceeding pybind11/pybind11.h
includes.
…ind11.h includes pybind11 seems decent about including Python.h before any system headers, once you chase three layers of includes in to see that.
PR summary
Python.h needs to be included before any system includes. This is easiest if it is the first include.
EDIT:
pybind11/pybind11.h
includes Python three headers in. There are two system headers included beforehand, if debugging with MSVC. I didn't know that when I made this, and can removePython.h
from beforepybind11/pybind11.h
if desired.Should fix the Cygwin problem noted in #27552
PR checklist