homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Compiler arning about 'Yield' macro redefinition on Windows
Type: compile error Stage: resolved
Components: Windows Versions: Python 3.10
process
Status: closed Resolution: duplicate
Dependencies: Superseder: Move PyArena C API to the internal C API
View: 43244
Assigned To: Nosy List: gvanrossum, paul.moore, steve.dower, tim.golden, vstinner, zach.ware
Priority: normal Keywords:

Created on 2021年04月07日 18:33 by gvanrossum, last changed 2022年04月11日 14:59 by admin. This issue is now closed.

Messages (4)
msg390462 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2021年04月07日 18:33
When building from scratch on Windows I get this warning:
c:\program files (x86)\windows kits10円\include10円.0.17763.0\um\winbase.h(103): warning C4005: 'Yield': macro redefinition [C:\Users\gvanrossum\cpython\PCbuild\pythoncore.vcxproj]
I know there is at least one place where we try to prevent this warning, e.g. in Include/internal/pycore_ast.h there's this line:
#undef Yield /* undefine macro conflicting with <winbase.h> */
But apparently this isn't enough, or the error comes from a different file, or some rearrangement of header files made this #undef ineffective.
Victor, is it possible that your https://github.com/python/cpython/pull/24933 reintroduced this warning?
Steve, what can I do to diagnose this better? (The warning doesn't tell me where winbase.h was included.)
msg390463 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2021年04月07日 18:34
This issue should be fixed:
commit d36d6a9c1808e87628ebaa855d4bec80130189f4
Author: Victor Stinner <vstinner@python.org>
Date: Wed Apr 7 13:01:09 2021 +0200
 bpo-43244: Remove Yield macro from pycore_ast.h (GH-25243)
 
 * pycore_ast.h no longer defines the Yield macro.
 * Fix a compiler warning on Windows: "warning C4005: 'Yield': macro
 redefinition".
 * Python-ast.c now defines directly functions with their real
 _Py_xxx() name, rather than xxx().
 * Remove "#undef Yield" in C files including pycore_ast.h.
msg390464 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2021年04月07日 18:35
Fixing this super annoying Yield warning was one of my motivation for moving Python-ast.h to the internal C API (pycore_ast.h) :-D I disliked that Python-ast.h defined tons of symbols without "Py" (or "_Py") prefix:
commit 94faa0724f8cbae6867c491c8e465e35f4fdbfbb
Author: Victor Stinner <vstinner@python.org>
Date: Tue Mar 23 20:47:40 2021 +0100
 bpo-43244: Remove ast.h, asdl.h, Python-ast.h headers (GH-24933)
 
 These functions were undocumented and excluded from the limited C
 API.
 
 Most names defined by these header files were not prefixed by "Py"
 and so could create names conflicts. For example, Python-ast.h
 defined a "Yield" macro which was conflict with the "Yield" name used
 by the Windows <winbase.h> header.
 
 Use the Python ast module instead.
 
 * Move Include/asdl.h to Include/internal/pycore_asdl.h.
 * Move Include/Python-ast.h to Include/internal/pycore_ast.h.
 * Remove ast.h header file.
 * pycore_symtable.h no longer includes Python-ast.h.
msg390466 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2021年04月07日 18:44
Thanks! Dup of bpo-43244.
History
Date User Action Args
2022年04月11日 14:59:44adminsetgithub: 87933
2021年04月07日 19:33:06vstinnersetsuperseder: Move PyArena C API to the internal C API
2021年04月07日 18:44:39gvanrossumsetstatus: open -> closed
resolution: duplicate
messages: + msg390466

stage: needs patch -> resolved
2021年04月07日 18:35:27vstinnersetmessages: + msg390464
2021年04月07日 18:34:00vstinnersetmessages: + msg390463
2021年04月07日 18:33:30gvanrossumcreate

AltStyle によって変換されたページ (->オリジナル) /