Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upFix compiler warning on Windows. #18012
Merged
+1
−1
Conversation
Python-ast.h contains a macro named YIELD that conflicts with the YIELD macro in Windows system headers. While Python-ast.h has an "undef YIELD" directive to prevent this, it means that Python-ast.h must be included before Windows header files or we run into a re-declaration warning. In commit c96be81 an include for pycore_pystate.h was added which indirectly includes Windows header files. In this commit we re-order the includes to fix this warning.
This comment has been minimized.
This comment has been minimized.
Built without warnings: https://github.com/python/cpython/pull/18012/checks?check_run_id=390916364#step:3:567 |
This comment has been minimized.
This comment has been minimized.
miss-islington
commented
Jan 15, 2020
Thanks @ammaraskar for the PR, and @zware for merging it |
This comment has been minimized.
This comment has been minimized.
bedevere-bot
commented
Jan 15, 2020
GH-18014 is a backport of this pull request to the 3.8 branch. |
miss-islington
added a commit
to miss-islington/cpython
that referenced
this pull request
Jan 15, 2020
Python-ast.h contains a macro named Yield that conflicts with the Yield macro in Windows system headers. While Python-ast.h has an "undef Yield" directive to prevent this, it means that Python-ast.h must be included before Windows header files or we run into a re-declaration warning. In commit c96be81 an include for pycore_pystate.h was added which indirectly includes Windows header files. In this commit we re-order the includes to fix this warning. (cherry picked from commit e92d393) Co-authored-by: Ammar Askar <ammar@ammaraskar.com>
miss-islington
added a commit
that referenced
this pull request
Jan 15, 2020
Python-ast.h contains a macro named Yield that conflicts with the Yield macro in Windows system headers. While Python-ast.h has an "undef Yield" directive to prevent this, it means that Python-ast.h must be included before Windows header files or we run into a re-declaration warning. In commit c96be81 an include for pycore_pystate.h was added which indirectly includes Windows header files. In this commit we re-order the includes to fix this warning. (cherry picked from commit e92d393) Co-authored-by: Ammar Askar <ammar@ammaraskar.com>
petdance
added a commit
to petdance/cpython
that referenced
this pull request
Jan 17, 2020
Python-ast.h contains a macro named Yield that conflicts with the Yield macro in Windows system headers. While Python-ast.h has an "undef Yield" directive to prevent this, it means that Python-ast.h must be included before Windows header files or we run into a re-declaration warning. In commit c96be81 an include for pycore_pystate.h was added which indirectly includes Windows header files. In this commit we re-order the includes to fix this warning.
petdance
added a commit
to petdance/cpython
that referenced
this pull request
Jan 17, 2020
Python-ast.h contains a macro named Yield that conflicts with the Yield macro in Windows system headers. While Python-ast.h has an "undef Yield" directive to prevent this, it means that Python-ast.h must be included before Windows header files or we run into a re-declaration warning. In commit c96be81 an include for pycore_pystate.h was added which indirectly includes Windows header files. In this commit we re-order the includes to fix this warning.
petdance
added a commit
to petdance/cpython
that referenced
this pull request
Jan 17, 2020
Python-ast.h contains a macro named Yield that conflicts with the Yield macro in Windows system headers. While Python-ast.h has an "undef Yield" directive to prevent this, it means that Python-ast.h must be included before Windows header files or we run into a re-declaration warning. In commit c96be81 an include for pycore_pystate.h was added which indirectly includes Windows header files. In this commit we re-order the includes to fix this warning.
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.
ammaraskar commentedJan 15, 2020
Looks like c96be81 introduced an include for
pycore_pystate.h
incompile.c
. This file indirectly includes Windows header files through the use of conditional variables.Since there is a conflict between the
Python-ast.h
YIELD macro and the windows YIELD macro: https://github.com/python/cpython/blob/master/Include/Python-ast.h#L12we have to include this file before Windows headers to avoid redeclaring the macro and running into this warning: https://github.com/python/cpython/runs/390843969#step:3:570