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.

Author vstinner
Recipients erikjanss, eryksun, paul.moore, steve.dower, tim.golden, vstinner, zach.ware
Date 2019-05-21.10:57:02
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1558436222.47.0.922377940813.issue36965@roundup.psfhosted.org>
In-reply-to
Content
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 */
...
---
History
Date User Action Args
2019-05-21 10:57:02vstinnersetrecipients: + vstinner, paul.moore, tim.golden, zach.ware, eryksun, steve.dower, erikjanss
2019-05-21 10:57:02vstinnersetmessageid: <1558436222.47.0.922377940813.issue36965@roundup.psfhosted.org>
2019-05-21 10:57:02vstinnerlinkissue36965 messages
2019-05-21 10:57:02vstinnercreate