STINNER Victor <vstin...@redhat.com> added the comment:

eryksun commented there, but I prefer to discuss here:
https://github.com/python/cpython/commit/925af1d99b69bf3e229411022ad840c5a0cfdcf8#commitcomment-33617265

""Windows.h" was already being included, as I mentioned on the issue tracker, 
because we certainly were not getting STATUS_CONTROL_C_EXIT from "crtdbg.h", a 
header that was left in this file accidentally about 12 years ago. If it's 
included explicitly here, also define WIN32_LEAN_AND_MEAN to cut the number of 
included headers by about a half."

I prefer to explicitly include windows.h, it doesn't hurt :-)

WIN32_LEAN_AND_MEAN is defined by Include/internal/pycore_condvar.h which is 
indirectly included by pycore_pystate.h:

#include "pycore_gil.h"   /* _gil_runtime_state  */

pycore_gil.h:

#include "pycore_condvar.h"


By the way, WIN32_LEAN_AND_MEAN caused me issues while working on bpo-36728:
https://twitter.com/VictorStinner/status/1127884878027079680

I managed to workaround the issue: commit 
d5d9e81ce9a7efc5bc14a5c21398d1ef6f626884

Extract of (fixed) posixmodule.c:
---
...
#include "Python.h"
#ifdef MS_WINDOWS
   /* include <windows.h> early to avoid conflict with pycore_condvar.h:

        #define WIN32_LEAN_AND_MEAN
        #include <windows.h>

      FSCTL_GET_REPARSE_POINT is not exported with WIN32_LEAN_AND_MEAN. */
#  include <windows.h>
#endif

#include "pycore_ceval.h"     /* _PyEval_ReInitThreads() */
#include "pycore_pystate.h"   /* _PyRuntime */
...
---

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue36965>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to