[issue36965] use of STATUS_CONTROL_C_EXIT in Modules/main.c breaks compilation with non MSC compilers

STINNER Victor report at bugs.python.org
Tue May 21 07:17:41 EDT 2019


STINNER Victor <vstinner at redhat.com> added the comment:

> WIN32_LEAN_AND_MEAN is defined by Include/internal/pycore_condvar.h (...)

It would be nice to get ride of #include <windows.h> in Python headers. The <windows.h> was introduced by this commit:

commit 2ebc5ce42a8a9e047e790aefbf9a94811569b2b6
Author: Eric Snow <ericsnowcurrently at gmail.com>
Date:   Thu Sep 7 23:51:28 2017 -0600

    bpo-30860: Consolidate stateful runtime globals. (#3397)
    
    * group the (stateful) runtime globals into various topical structs
    * consolidate the topical structs under a single top-level _PyRuntimeState struct
    * add a check-c-globals.py script that helps identify runtime globals
    
    Other globals are excluded (see globals.txt and check-c-globals.py).

The current problem is that we need the HANDLE type which comes from <windows.h> to get the full structure:

typedef struct _PyCOND_T
{
    HANDLE sem;
    int waiting; /* to allow PyCOND_SIGNAL to be a no-op */
} PyCOND_T;

I tried to avoid "HANDLE" using:

typedef struct _PyCOND_T
{
    void* sem;
    int waiting; /* to allow PyCOND_SIGNAL to be a no-op */
} PyCOND_T;

... but then pycore_condvar.h compilation fails on "typedef CRITICAL_SECTION PyMUTEX_T;": CRITICAL_SECTION type is not defined :-(

By the way, Python still uses _PY_EMULATED_WIN_CV by default, whereas we want to drop Vista support: bpo-32592.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue36965>
_______________________________________


More information about the Python-bugs-list mailing list