bpo-35177, Python-ast.h: Fix compiler warning on Yield#10664
bpo-35177, Python-ast.h: Fix compiler warning on Yield#10664vstinner merged 1 commit intopython:masterfrom vstinner:yield
Conversation
Partially revert commit 5f2df88: remove "#undef Yield" from Python-ast.h and move it back to .c files.
|
Fix this warning: |
|
I checked on my Windows VM and an AppVeyor that warnings are gone. |
|
|
||
| #include "Python.h" /* general Python API */ | ||
| #include "Python-ast.h" /* mod_ty */ | ||
| #undef Yield /* undefine macro conflicting with <winbase.h> */ |
There was a problem hiding this comment.
Aren't most of these redundant now that python-ast.h undefines it?
There was a problem hiding this comment.
I made the same remark than you, but... no :-) <winbase.h> and "Python-ast.h" both define Yield. Usually, we don't care of Yield from Python-ast.h, so we undefine it after including Python-ast.h. Sometimes, <winbase.h> is included before "Python-ast.h" and so "Python-ast.h" has to undefine it.
Yield from Python-ast.h is only used once, in ast.c... Maybe Python-ast.h must never define it and ast.c should define it instead? It's a very stupid define...
#define Yield(a0, a1, a2, a3) _Py_Yield(a0, a1, a2, a3)
This PR restores the status quo of Python 3.7, since my previous attempt supposed to remove warnings introduced the "Yield warning".
There was a problem hiding this comment.
@zooba: If you see a smarter solution and/or care of this #undef, please go ahead :-) In the meanwhile, I restored the code as it was previously :-)
Partially revert commit 5f2df88:
remove "#undef Yield" from Python-ast.h and move it back to .c files.
https://bugs.python.org/issue35177