Skip to content

WIP: Python 3.13 #185

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 123 commits into
base: mingw-v3.13.1
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
123 commits
Select commit Hold shift + click to select a range
7b6cfcc
sysconfig: make _sysconfigdata.py relocatable
mingwandroid Jun 17, 2021
d98f356
build: add --with-nt-threads and make it default on mingw
Alexpux Jun 17, 2021
3f02a9d
Define `MS_WINDOWS` (and others) when compiling with MINGW
Alexpux Jun 17, 2021
4fbe16a
configure: add `MACHDEP` and `platform` on MINGW
Alexpux Jun 17, 2021
e93e83b
Add default configuration for MINGW
Alexpux Jun 17, 2021
45fed1c
configure: enable largefile support by default for Mingw
Alexpux Jun 17, 2021
699b1be
Add `PC/` to `CPPFLAGS` and to `SRCDIRS` on Mingw
Alexpux Jun 17, 2021
b3637a9
posixmodule.c: Define necessary headers for compiling on MINGW
Alexpux Jun 17, 2021
ddb028a
Build winreg by default when compiling for MINGW
Alexpux Jun 17, 2021
37b8dd2
exports.h: Add support for MINGW
Alexpux Jun 17, 2021
d4ea550
configure: add options so that shared build is possible on MINGW
Alexpux Jun 17, 2021
9bcfb09
Add dynamic loading support for MINGW
Alexpux Jun 17, 2021
1b00d76
Ignore main program for frozen scripts on MINGW
Alexpux Jun 17, 2021
7844491
Detect winsock2 and setup _socket module on MINGW
Alexpux Jun 17, 2021
be45d43
Enable some windows specific modules
naveen521kk Feb 14, 2023
02f3a6b
sysconfig: MINGW build extensions with GCC
lazka Sep 21, 2021
b78b6d7
sysconfig: treat MINGW builds as POSIX builds
Alexpux Jun 17, 2021
1defca9
Add support for stdcall without underscore
Alexpux Jun 17, 2021
c5977b1
site.py: customize for MINGW
Alexpux Jun 17, 2021
14f7b17
add python config sh
Alexpux Jun 17, 2021
c0432a6
mingw: prefer unix sep if MSYSTEM environment variable
mingwandroid Jun 17, 2021
3df74ce
msys cygwin semi native build sysconfig
Alexpux Jun 17, 2021
72f71db
sysconfig: mingw sysconfig like posix
lazka Sep 21, 2021
c72ee4a
mingw use backslashes in compileall py
Alexpux Jun 17, 2021
d938e64
py_curses.h: define mingw pdcurses _ISPAD
Alexpux Jun 17, 2021
be30615
remove_path_max.default
Alexpux Jun 17, 2021
b793385
dont link with gettext
Alexpux Jun 17, 2021
d185d38
ctypes python dll
Alexpux Jun 17, 2021
90d57c8
gdbm module includes
Alexpux Jun 17, 2021
08a21e4
use gnu_printf in format
Alexpux Jun 17, 2021
bd3a9ca
mingw fix ssl dont use enum_certificates
mingwandroid Jun 17, 2021
c76158f
fix using dllhandle and winver mingw
Alexpux Jun 17, 2021
cd5830a
Add AMD64 to sys config so msvccompiler get_build_version works
Alexpux Jun 17, 2021
a48c4b0
MINGW link with additional library
Alexpux Jun 17, 2021
2ffc756
fix signal module build
lazka Jun 17, 2021
4ef37a4
build: build winconsoleio and _testconsole
lazka Jun 17, 2021
127f694
multiprocessing: expose sem_unlink
lazka Jun 17, 2021
89796aa
Use cygpty while using isatty
lazka Jun 17, 2021
9bef749
build: link win resource files and build pythonw
lazka Jun 17, 2021
a381a08
fileutils: fix isselectable on windows
lazka Jun 17, 2021
fd84f7b
configure.ac: fix inet_pton check
lazka Jun 17, 2021
e0076dc
pass gen profile ldflags
lazka Jun 17, 2021
ecbb7ac
pkg config windows must link ext with python lib
Alexpux Jun 17, 2021
a129c8e
importlib bootstrap path sep
lazka Jun 17, 2021
175d038
warnings fixes
Alexpux Jun 17, 2021
1e2a401
fix build testinternalcapi
naveen521kk Jun 16, 2023
4401bc9
clang arm64
jeremyd2019 Jun 17, 2021
6966ce7
configure.ac: set MINGW stack reserve
jeremyd2019 Jun 17, 2021
acbba6d
Don't use os.pathsep to find EOF
naveen521kk Jun 18, 2021
8ac9509
Fix extension suffix for c-extensions on mingw
naveen521kk Jun 23, 2021
0ce6d6a
Change the `get_platform()` method in sysconfig
naveen521kk Sep 21, 2021
15a3f1e
tests: fix test_bytes
lazka Jul 23, 2021
850e8ac
time: fix strftime not raising for invalid year values
lazka Jul 23, 2021
e98135b
ctypes: find_library('c') should return None with ucrt
lazka Jul 23, 2021
c2a3cc5
build: Disable checks for dlopen/dlfcn
lazka Jul 25, 2021
28e5ac5
Fix install location of the import library
lazka Jul 25, 2021
01f1a0b
build: Integrate venvlauncher build/installation into the Makefile
lazka Jul 25, 2021
704f4bc
configure.ac: set _WIN32_WINNT version
lazka Aug 1, 2021
2bfc607
configure.ac: don't check for clock_ functions
lazka Aug 1, 2021
ca092e6
expanduser: normpath paths coming from env vars
lazka Aug 8, 2021
dc7a50d
CI: test the build and add some mingw specific tests
naveen521kk Jun 18, 2021
0d59851
Define PY3_DLLNAME to fix build
naveen521kk Oct 12, 2021
1dd219c
_testconsole.c: Fix casing & path sep
longnguyen2004 Nov 14, 2021
d3f80d1
Return consistent architecture markers for python on mingw/armv7
mstorsjo Nov 19, 2021
79ac1d2
mingw_smoketests: fix _UCRT condition
jeremyd2019 Jan 22, 2022
ed53bd2
Modify `sys.winver` to match upstream
naveen521kk Jan 19, 2022
e7fb3ba
Change user site-packages path to include the environment info
naveen521kk Jan 19, 2022
255ce8d
configure: Include a header in the check for _beginthread
mstorsjo Apr 21, 2022
4b6d9f1
configure.ac: Default to --without-c-locale-coercion on Windows
lazka Apr 22, 2022
818d212
Fix failing tests
naveen521kk Jun 5, 2022
cca7447
Don't change os.sep with an empty MSYSTEM env var, not just a missing…
lazka Sep 22, 2022
d4ea2cf
def VPATH when compiling `Python/sysmodule.c`
naveen521kk Jun 18, 2023
d4f04a1
Make `_Py_CheckPython3` extern
naveen521kk Jun 18, 2023
6267ec9
link with bcrypt
naveen521kk Jun 18, 2023
821e3dd
correctly find native python
naveen521kk Jun 18, 2023
9fc4705
Add extra flags for `_bootstrap_python`
naveen521kk Jun 18, 2023
b4a3669
posixmodule: undefine `HAVE_OPENDIR`
naveen521kk Jun 20, 2023
dc3fd8d
getpath.py: add support for mingw
naveen521kk Jun 20, 2023
bd5f070
Don't build _posixsubprocess on Windows.
naveen521kk Jun 20, 2023
145be6f
`_ssl`: link with `ws2_32`
naveen521kk Jun 20, 2023
24cb8aa
Always normalize path in abspath
naveen521kk Jun 20, 2023
581b874
Include `winsock.h` when checking for netdb function
naveen521kk Jun 21, 2023
a008a9d
include `_multiprocessing/semaphore.c` on win32
naveen521kk Jun 23, 2023
77720cf
configure: build `mmap` module on win32
naveen521kk Jun 23, 2023
5517629
venv creation fixes
naveen521kk Jun 23, 2023
daf52f6
move the `shutdown` function where `winsock.h` is included
naveen521kk Jun 23, 2023
a6f0989
configure.ac: set BUILDEXEEXT and EXEEXT
lazka Jun 23, 2023
a68ed87
configure.ac: fix building some test modules
lazka Jun 23, 2023
63740f0
Don't convert `sysconfig.get_config_var('VPATH')` to an absolute path
naveen521kk Jun 25, 2023
bf445a6
Always convert `/` to `\\` before passing though pathcch functions
naveen521kk Jun 25, 2023
12e0b3d
Build venvlauncher.exe from PC/launcher.c
naveen521kk Jun 25, 2023
c056390
getpath.py: fix `dirname`
naveen521kk Jun 25, 2023
364b1ef
getpath: use normpath on all generated paths
lazka Jul 28, 2023
f7bdd04
pathconfig: normpath sys.path[0]
lazka Jul 28, 2023
a9d209a
smoketests: add some tests for sys/site paths
lazka Jul 28, 2023
8d4891f
Search DLLs only on paths added using `add_dll_directory()`.
naveen521kk Aug 5, 2023
80c4dd3
Build and install libpython3.dll
lazka Aug 21, 2023
09a4b1c
Port GetPythonImport() to mingw
lazka Aug 27, 2023
ab9c0a7
LoadLibraryExW: make sure to only use backslashes for paths
lazka Aug 27, 2023
8fcb6a5
mingw_smoketests: add a test to check if sysconfig returns correct va…
naveen521kk Nov 8, 2023
27e6f5a
Add missing library for multiprocessing module
naveen521kk Jan 1, 2024
bf8be99
selectmodule: add support for MINGW
naveen521kk Jan 1, 2024
30c4df4
readline: disable on MINGW
naveen521kk Jan 1, 2024
41ab1f5
Add libraries to fix compile of ctypes on MINGW
naveen521kk Jan 1, 2024
a1c7839
Enable `_uuid` on MINGW
naveen521kk Jan 1, 2024
ef51e5b
mingw_smoketests: disable distutils related tests
naveen521kk Feb 2, 2024
2c20fbb
configure.ac: use autoconf 2.69
naveen521kk Feb 19, 2024
786c189
CI: clean up ignored tests
naveen521kk Feb 20, 2024
e620935
gcc: make `incompatible-pointer-types` as warning
naveen521kk Jul 11, 2024
d7cb2fa
test_makefile: normalize path
naveen521kk Sep 8, 2024
bb0bc39
`sysconfig.get_platform()`: use consistent naming
naveen521kk Sep 12, 2024
174b23c
Add ucrt to version string
naveen521kk Nov 1, 2024
0649b85
socketmodule: fix captilization of headers
naveen521kk Nov 2, 2024
3b5339c
mingw_smoketests: build extension in a venv
lazka Dec 22, 2024
385c6d6
venvlauncher: try looking for the versioned .exe first and then fall …
lazka Dec 23, 2024
9ba27e7
fixup! CI: test the build and add some mingw specific tests
lazka Dec 24, 2024
82c98eb
configure.ac: disable check sizeof pid_t for mingw
naveen521kk Dec 25, 2024
50dc0eb
pytime.c: change the order of includes
naveen521kk Dec 25, 2024
3545d44
mmapmodule: disable exceptions handling
naveen521kk Dec 25, 2024
6166614
Makefile.pre.in: allow pgo to fail
naveen521kk Dec 25, 2024
70b1f4d
Export `Py_GetBuildInfo` to enable stable ABI
naveen521kk Dec 27, 2024
26b8ab0
calculate_log2_keysize: use Windows implementation not just with MSVC
lazka Dec 27, 2024
00d0dfb
posixmodule: use lowercase for headers
naveen521kk Dec 27, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
297 changes: 297 additions & 0 deletions .github/workflows/mingw.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,297 @@
name: Build
on: [push, pull_request, workflow_dispatch]

jobs:
build:
runs-on: windows-2022
strategy:
fail-fast: false
matrix:
msystem: ['MINGW64','MINGW32','UCRT64','CLANG64']
include:
- msystem: MINGW64
prefix: mingw-w64-x86_64
- msystem: MINGW32
prefix: mingw-w64-i686
- msystem: UCRT64
prefix: mingw-w64-ucrt-x86_64
- msystem: CLANG64
prefix: mingw-w64-clang-x86_64
steps:
- name: Setup git
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- uses: actions/checkout@v3
- uses: msys2/setup-msys2@v2
with:
msystem: ${{ matrix.msystem }}
release: false
update: true
install: >-
make
binutils
autoconf
autoconf-archive
automake-wrapper
tar
gzip
${{ matrix.prefix }}-toolchain
${{ matrix.prefix }}-expat
${{ matrix.prefix }}-bzip2
${{ matrix.prefix }}-libffi
${{ matrix.prefix }}-mpdecimal
${{ matrix.prefix }}-ncurses
${{ matrix.prefix }}-openssl
${{ matrix.prefix }}-sqlite3
${{ matrix.prefix }}-tcl
${{ matrix.prefix }}-tk
${{ matrix.prefix }}-zlib
${{ matrix.prefix }}-xz
${{ matrix.prefix }}-tzdata

- name: Build Python
shell: msys2 {0}
run: |
set -ex

if [[ "${{ matrix.msystem }}" == CLANG* ]]; then
export CC=clang
export CXX=clang++
fi
autoreconf -vfi

rm -Rf _build && mkdir _build && cd _build

../configure \
--prefix=${MINGW_PREFIX} \
--host=${MINGW_CHOST} \
--build=${MINGW_CHOST} \
--enable-shared \
--with-system-expat \
--with-system-libmpdec \
--without-ensurepip \
--enable-loadable-sqlite-extensions \
--with-tzpath=${MINGW_PREFIX}/share/zoneinfo \
--enable-optimizations

make -j8

- name: Run Smoke Test (build)
shell: msys2 {0}
run: |
SMOKETESTS="$(pwd)/mingw_smoketests.py"
cd _build
./python.exe "$SMOKETESTS"
MSYSTEM= ./python.exe "$SMOKETESTS"

- name: Run tests
shell: msys2 {0}
run: |
IGNOREFILE="$(pwd)/mingw_ignorefile.txt"
IGNOREFILE_EXTRA="$IGNOREFILE"
if [[ "${{ matrix.msystem }}" == "MINGW32" ]] || [[ "${{ matrix.msystem }}" == "MINGW64" ]]; then
IGNOREFILE_EXTRA="$(pwd)/mingw_ignorefile_msvcrt.txt"
fi
cd _build
MSYSTEM= ./python.exe -m test -j8 --ignorefile "$IGNOREFILE" --ignorefile "$IGNOREFILE_EXTRA" -W

- name: Run broken tests
continue-on-error: true
shell: msys2 {0}
run: |
IGNOREFILE="$(pwd)/mingw_ignorefile.txt"
IGNOREFILE_EXTRA="$IGNOREFILE"
if [[ "${{ matrix.msystem }}" == "MINGW32" ]] || [[ "${{ matrix.msystem }}" == "MINGW64" ]]; then
IGNOREFILE_EXTRA="$(pwd)/mingw_ignorefile_msvcrt.txt"
fi
cd _build
MSYSTEM= ./python.exe -m test -j8 --matchfile "$IGNOREFILE" --matchfile "$IGNOREFILE_EXTRA" -W

- name: Install
shell: msys2 {0}
run: |
set -ex
cd _build

pkgdir=python_pkgdir

make -j1 install DESTDIR="${pkgdir}"

# Fix shebangs
_pybasever=$(./python.exe -c "import sys; print(f'{sys.version_info[0]}.{sys.version_info[1]}');")
for fscripts in 2to3 2to3-${_pybasever} idle3 idle${_pybasever} pydoc3 pydoc${_pybasever}; do
sed -i "s|$(cygpath -w ${MINGW_PREFIX} | sed 's|\\|\\\\|g')/bin/python${_pybasever}.exe|/usr/bin/env python${_pybasever}.exe|g" "${pkgdir}${MINGW_PREFIX}"/bin/${fscripts}
done
sed -i "s|#!${MINGW_PREFIX}/bin/python${_pybasever}.exe|#!/usr/bin/env python${_pybasever}.exe|" "${pkgdir}${MINGW_PREFIX}"/lib/python${_pybasever}/config-${_pybasever}/python-config.py

# Create version-less aliases
cp "${pkgdir}${MINGW_PREFIX}"/bin/python3.exe "${pkgdir}${MINGW_PREFIX}"/bin/python.exe
cp "${pkgdir}${MINGW_PREFIX}"/bin/python3w.exe "${pkgdir}${MINGW_PREFIX}"/bin/pythonw.exe
cp "${pkgdir}${MINGW_PREFIX}"/bin/python3-config "${pkgdir}${MINGW_PREFIX}"/bin/python-config
cp "${pkgdir}${MINGW_PREFIX}"/bin/idle3 "${pkgdir}${MINGW_PREFIX}"/bin/idle
cp "${pkgdir}${MINGW_PREFIX}"/bin/pydoc3 "${pkgdir}${MINGW_PREFIX}"/bin/pydoc

# copy to /
cp -rf "${pkgdir}"/* /

- name: Run Smoke Test (installed)
shell: msys2 {0}
run: |
SMOKETESTS="$(pwd)/mingw_smoketests.py"
${MINGW_PREFIX}/bin/python.exe "$SMOKETESTS"
MSYSTEM= ${MINGW_PREFIX}/bin/python.exe "$SMOKETESTS"

- name: Compress
if: always()
shell: msys2 {0}
run: |
cd _build
tar -zcf python.tar.gz python_pkgdir/

- name: Upload
uses: actions/upload-artifact@v3
if: always()
with:
name: build-${{ matrix.msystem }}
path: _build/python.tar.gz

cross-gcc-x86_64:
runs-on: ubuntu-latest
container:
image: ubuntu:24.10
steps:
- uses: actions/checkout@v3
- name: Install deps
run: |
apt-get update
DEBIAN_FRONTEND=noninteractive apt-get install -y \
gcc-mingw-w64-x86-64 \
g++-mingw-w64-x86-64 \
autoconf-archive \
autoconf \
automake \
zip \
make \
pkg-config

- uses: actions/setup-python@v4
with:
python-version: '3.13'

- name: Check Python Version
run: |
which python
python --version

- name: Build
run: |
autoreconf -vfi

mkdir _build && cd _build

../configure \
--host=x86_64-w64-mingw32 \
--build=x86_64-pc-linux-gnu \
--enable-shared \
--without-ensurepip \
--enable-loadable-sqlite-extensions \
--with-build-python=yes

make -j8

make install DESTDIR="$(pwd)/install"

- name: 'Zip files'
run: |
zip -r install.zip _build/install

- name: Upload
uses: actions/upload-artifact@v3
with:
name: build-cross-gcc-x86_64
path: install.zip

cross-gcc-x86_64-test:
needs: [cross-gcc-x86_64]
runs-on: windows-latest
steps:
- uses: actions/download-artifact@v3
with:
name: build-cross-gcc-x86_64

- name: 'Run tests'
run: |
7z x install.zip
./_build/install/usr/local/bin/python3.exe -c "import sysconfig, pprint; pprint.pprint(sysconfig.get_config_vars())"


cross-llvm-mingw:
runs-on: ubuntu-latest
container:
image: mstorsjo/llvm-mingw:latest
strategy:
fail-fast: false
matrix:
arch: ['x86_64', 'i686', 'aarch64', 'armv7']
steps:
- uses: actions/checkout@v3

- name: Install deps
run: |
export DEBIAN_FRONTEND=noninteractive
apt-get update -qq
apt-get install -qqy software-properties-common
add-apt-repository --yes ppa:deadsnakes/ppa
apt-get update -qq
apt-get install -qqy autoconf-archive python3.13-dev python3.13

- name: Build
run: |
autoreconf -vfi

mkdir _build && cd _build

export CC=${{ matrix.arch }}-w64-mingw32-clang
export CXX=${CC}++
../configure \
--host=${{ matrix.arch }}-w64-mingw32 \
--build=x86_64-pc-linux-gnu \
--enable-shared \
--without-ensurepip \
--without-c-locale-coercion \
--enable-loadable-sqlite-extensions \
--with-build-python=yes

make -j8

make install DESTDIR="$(pwd)/install"

- name: 'Zip files'
run: |
zip -r install.zip _build/install

- name: Upload
uses: actions/upload-artifact@v3
with:
name: build-cross-llvm-mingw-${{ matrix.arch }}
path: install.zip

cross-llvm-mingw-test:
needs: [cross-llvm-mingw]
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
arch: ['x86_64', 'i686']
steps:
- uses: actions/download-artifact@v3
with:
name: build-cross-llvm-mingw-${{ matrix.arch }}

- name: 'Run tests'
run: |
7z x install.zip
./_build/install/usr/local/bin/python3.exe -c "import sysconfig, pprint; pprint.pprint(sysconfig.get_config_vars())"


4 changes: 2 additions & 2 deletions Include/bytesobject.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ PyAPI_FUNC(PyObject *) PyBytes_FromStringAndSize(const char *, Py_ssize_t);
PyAPI_FUNC(PyObject *) PyBytes_FromString(const char *);
PyAPI_FUNC(PyObject *) PyBytes_FromObject(PyObject *);
PyAPI_FUNC(PyObject *) PyBytes_FromFormatV(const char*, va_list)
Py_GCC_ATTRIBUTE((format(printf, 1, 0)));
Py_PRINTF(1, 0);
PyAPI_FUNC(PyObject *) PyBytes_FromFormat(const char*, ...)
Py_GCC_ATTRIBUTE((format(printf, 1, 2)));
Py_PRINTF(1, 2);
PyAPI_FUNC(Py_ssize_t) PyBytes_Size(PyObject *);
PyAPI_FUNC(char *) PyBytes_AsString(PyObject *);
PyAPI_FUNC(PyObject *) PyBytes_Repr(PyObject *, int);
Expand Down
20 changes: 11 additions & 9 deletions Include/exports.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
*/

/*
All windows ports, except cygwin, are handled in PC/pyconfig.h.
Only MSVC windows port is handled in PC/pyconfig.h.

Cygwin is the only other autoconf platform requiring special
Cygwin and Mingw is the other autoconf platforms requiring special
linkage handling and it uses __declspec().
*/
#if defined(__CYGWIN__)
#if defined(__CYGWIN__) || defined(__MINGW32__)
# define HAVE_DECLSPEC_DLL
#endif

Expand Down Expand Up @@ -63,21 +63,23 @@
# define PyAPI_FUNC(RTYPE) Py_EXPORTED_SYMBOL RTYPE
# define PyAPI_DATA(RTYPE) extern Py_EXPORTED_SYMBOL RTYPE
/* module init functions inside the core need no external linkage */
/* except for Cygwin to handle embedding */
# if defined(__CYGWIN__)
/* except for Cygwin/Mingw to handle embedding */
# if defined(__CYGWIN__) || defined(__MINGW32__)
# define PyMODINIT_FUNC Py_EXPORTED_SYMBOL PyObject*
# else /* __CYGWIN__ */
# else /* __CYGWIN__ || __MINGW32__ */
# define PyMODINIT_FUNC PyObject*
# endif /* __CYGWIN__ */
# endif /* __CYGWIN__ || __MINGW32__ */
# else /* Py_BUILD_CORE */
/* Building an extension module, or an embedded situation */
/* public Python functions and data are imported */
/* Under Cygwin, auto-import functions to prevent compilation */
/* failures similar to those described at the bottom of 4.1: */
/* http://docs.python.org/extending/windows.html#a-cookbook-approach */
# if !defined(__CYGWIN__)
# if defined(__CYGWIN__) || defined(__MINGW32__)
# define PyAPI_FUNC(RTYPE) RTYPE
# else
# define PyAPI_FUNC(RTYPE) Py_IMPORTED_SYMBOL RTYPE
# endif /* !__CYGWIN__ */
# endif /* __CYGWIN__ || __MINGW32__ */
# define PyAPI_DATA(RTYPE) extern Py_IMPORTED_SYMBOL RTYPE
/* module init functions outside the core must be exported */
# if defined(__cplusplus)
Expand Down
5 changes: 5 additions & 0 deletions Include/internal/pycore_condvar.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@
#define WIN32_LEAN_AND_MEAN
#include <windows.h> // CRITICAL_SECTION

/* winpthreads are involved via windows header, so need undef _POSIX_THREADS after header include */
#if defined(_POSIX_THREADS)
# undef _POSIX_THREADS
#endif

/* options */
/* emulated condition variables are provided for those that want
* to target Windows XP or earlier. Modify this macro to enable them.
Expand Down
2 changes: 1 addition & 1 deletion Include/internal/pycore_fileutils.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ extern "C" {


/* A routine to check if a file descriptor can be select()-ed. */
#ifdef _MSC_VER
#ifdef MS_WINDOWS
/* On Windows, any socket fd can be select()-ed, no matter how high */
#define _PyIsSelectable_fd(FD) (1)
#else
Expand Down
6 changes: 6 additions & 0 deletions Include/internal/pycore_pythread.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ extern "C" {
#include "dynamic_annotations.h" // _Py_ANNOTATE_PURE_HAPPENS_BEFORE_MUTEX
#include "pycore_llist.h" // struct llist_node

#ifdef __MINGW32__
# if !defined(HAVE_PTHREAD_H) || defined(NT_THREADS)
# undef _POSIX_THREADS
# endif
#endif

// Get _POSIX_THREADS and _POSIX_SEMAPHORES macros if available
#if (defined(HAVE_UNISTD_H) && !defined(_POSIX_THREADS) \
&& !defined(_POSIX_SEMAPHORES))
Expand Down
Loading
Loading