[Python-checkins] Fix compiler warning on Windows (GH-18012)

Zachary Ware webhook-mailer at python.org
Wed Jan 15 11:48:48 EST 2020


https://github.com/python/cpython/commit/e92d39303feb1d3b4194c6a8275b1fc63b2153b2
commit: e92d39303feb1d3b4194c6a8275b1fc63b2153b2
branch: master
author: Ammar Askar <ammar at ammaraskar.com>
committer: Zachary Ware <zach at python.org>
date: 2020-01-15T10:48:40-06:00
summary:

Fix compiler warning on Windows (GH-18012)

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 c96be811fa7d
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.

files:
M Python/compile.c

diff --git a/Python/compile.c b/Python/compile.c
index 3138a3f50dd1c..1d16e69a08556 100644
--- a/Python/compile.c
+++ b/Python/compile.c
@@ -23,8 +23,8 @@
 
 #include "Python.h"
 
-#include "Python-ast.h"
 #include "pycore_pystate.h"   /* _PyInterpreterState_GET_UNSAFE() */
+#include "Python-ast.h"
 #include "ast.h"
 #include "code.h"
 #include "symtable.h"



More information about the Python-checkins mailing list