Lines Matching +full:debian +full:- +full:arm32
1 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
4 --- /dev/null
6 @@ -0,0 +1,418 @@
9 +# gh-84728: "paths-ignore" is not used to skip documentation-only PRs, because
11 +# mandatory but not scheduled because of "paths-ignore".
16 + - 'main'
17 + - '3.11'
18 + - '3.10'
19 + - '3.9'
20 + - '3.8'
21 + - '3.7'
24 + - 'main'
25 + - '3.11'
26 + - '3.10'
27 + - '3.9'
28 + - '3.8'
29 + - '3.7'
35 + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
36 + cancel-in-progress: true
41 + runs-on: ubuntu-latest
42 + timeout-minutes: 10
48 + - uses: actions/checkout@v3
49 + - name: Check for source changes
52 + if [ -z "$GITHUB_BASE_REF" ]; then
56 + git fetch origin $GITHUB_BASE_REF --depth=1
60 + # "git fetch --depth=1").
69 + # https://github.com/python/core-workflow/issues/373
70 + git diff --name-only origin/$GITHUB_BASE_REF.. | grep -qvE '(\.rst$|^Doc|^Misc)' && ec…
71 + git diff --name-only origin/$GITHUB_BASE_REF.. | grep -qE '(ssl|hashlib|hmac|^.github)…
73 + - name: Compute hash for config cache key
80 + runs-on: ubuntu-20.04
84 + - uses: actions/checkout@v2
85 + - uses: actions/setup-python@v2
86 + - name: Install Dependencies
88 + sudo ./.github/workflows/posix-deps-apt.sh
89 + sudo apt-get install -yq abigail-tools
90 + - name: Build CPython
92 + CFLAGS: -g3 -O0
95 + ./configure --enable-shared
96 + make -j4
97 + - name: Check for changes in the ABI
100 + if ! make check-abidump; then
106 … echo "To learn more about this check: https://devguide.python.org/setup/#regenerate-the-abi-dump"
110 + - name: Generate updated ABI files
113 + make regen-abidump
114 + - uses: actions/upload-artifact@v3
118 + name: abi-data
123 + runs-on: ubuntu-latest
124 + timeout-minutes: 60
128 + - uses: actions/checkout@v3
129 + - name: Restore config.cache
133 + key: ${{ github.job }}-${{ runner.os }}-${{ needs.check_source.outputs.config_hash }}
134 + - uses: actions/setup-python@v3
135 + - name: Install Dependencies
136 + run: sudo ./.github/workflows/posix-deps-apt.sh
137 + - name: Add ccache to PATH
139 + - name: Configure ccache action
140 + uses: hendrikmuhs/ccache-action@v1.2
141 + - name: Check Autoconf version 2.69 and aclocal 1.16.3
145 + grep -q "runstatedir" configure
146 + grep -q "PKG_PROG_PKG_CONFIG" aclocal.m4
147 + - name: Configure CPython
150 + ./configure --config-cache --with-pydebug --enable-shared
151 + - name: Regenerate autoconf files with container image
152 + run: make regen-configure
153 + - name: Build CPython
156 + # so we run it before regen-global-objects gets rum (in regen-all).
157 + make regen-deepfreeze
158 + make -j4 regen-all
159 + make regen-stdlib-module-names
160 + - name: Check for changes
162 + git add -u
163 + changes=$(git status --porcelain)
165 + if test -n "$changes"; then
167 + echo "Perhaps you forgot to run make regen-all or build.bat --regen. ;)"
171 + git diff --staged || true
174 + - name: Check exported libpython symbols
176 + - name: Check limited ABI symbols
177 + run: make check-limited-abi
181 + runs-on: windows-latest
182 + timeout-minutes: 60
188 + - uses: actions/checkout@v3
189 + - name: Build CPython
190 + run: .\PCbuild\build.bat -e -d -p Win32
191 + - name: Display build info
192 + run: .\python.bat -m test.pythoninfo
193 + - name: Tests
194 + run: .\PCbuild\rt.bat -p Win32 -d -q -uall -u-cpu -rwW --slowest --timeout=1200 -j0
198 + runs-on: windows-latest
199 + timeout-minutes: 60
205 + - uses: actions/checkout@v3
206 + - name: Register MSVC problem matcher
207 + run: echo "::add-matcher::.github/problem-matchers/msvc.json"
208 + - name: Build CPython
209 + run: .\PCbuild\build.bat -e -d -p x64
210 + - name: Display build info
211 + run: .\python.bat -m test.pythoninfo
212 + - name: Tests
213 + run: .\PCbuild\rt.bat -p x64 -d -q -uall -u-cpu -rwW --slowest --timeout=1200 -j0
217 + runs-on: macos-latest
218 + timeout-minutes: 60
227 + - uses: actions/checkout@v3
228 + - name: Restore config.cache
232 + key: ${{ github.job }}-${{ runner.os }}-${{ needs.check_source.outputs.config_hash }}
233 + - name: Install Homebrew dependencies
234 + run: brew install pkg-config openssl@1.1 xz gdbm tcl-tk
235 + - name: Configure CPython
237 + CFLAGS="-I$(brew --prefix gdbm)/include -I$(brew --prefix xz)/include" \
238 + LDFLAGS="-L$(brew --prefix gdbm)/lib -I$(brew --prefix xz)/lib" \
239 + PKG_CONFIG_PATH="$(brew --prefix tcl-tk)/lib/pkgconfig" \
241 + --config-cache \
242 + --with-pydebug \
243 + --prefix=/opt/python-dev \
244 + --with-openssl="$(brew --prefix openssl@1.1)"
245 + - name: Build CPython
246 + run: make -j4
247 + - name: Display build info
249 + - name: Tests
250 + run: make buildbottest TESTOPTS="-j4 -uall,-cpu"
254 + runs-on: ubuntu-20.04
255 + timeout-minutes: 60
262 + - uses: actions/checkout@v3
263 + - name: Register gcc problem matcher
264 + run: echo "::add-matcher::.github/problem-matchers/gcc.json"
265 + - name: Install Dependencies
266 + run: sudo ./.github/workflows/posix-deps-apt.sh
267 + - name: Configure OpenSSL env vars
272 + - name: 'Restore OpenSSL build'
273 + id: cache-openssl
277 + key: ${{ runner.os }}-multissl-openssl-${{ env.OPENSSL_VER }}
278 + - name: Install OpenSSL
279 + if: steps.cache-openssl.outputs.cache-hit != 'true'
280 …run: python3 Tools/ssl/multissltests.py --steps=library --base-directory $MULTISSL_DIR --openssl $…
281 + - name: Add ccache to PATH
284 + - name: Configure ccache action
285 + uses: hendrikmuhs/ccache-action@v1.2
286 + - name: Setup directory envs for out-of-tree builds
288 + echo "CPYTHON_RO_SRCDIR=$(realpath -m ${GITHUB_WORKSPACE}/../cpython-ro-srcdir)" >> $GITHU…
289 + echo "CPYTHON_BUILDDIR=$(realpath -m ${GITHUB_WORKSPACE}/../cpython-builddir)" >> $GITHUB_…
290 + - name: Create directories for read-only out-of-tree builds
291 + run: mkdir -p $CPYTHON_RO_SRCDIR $CPYTHON_BUILDDIR
292 + - name: Bind mount sources read-only
293 + run: sudo mount --bind -o ro $GITHUB_WORKSPACE $CPYTHON_RO_SRCDIR
294 + - name: Restore config.cache
298 + key: ${{ github.job }}-${{ runner.os }}-${{ needs.check_source.outputs.config_hash }}
299 + - name: Configure CPython out-of-tree
300 + working-directory: ${{ env.CPYTHON_BUILDDIR }}
302 + ../cpython-ro-srcdir/configure \
303 + --config-cache \
304 + --with-pydebug \
305 + --with-openssl=$OPENSSL_DIR
306 + - name: Build CPython out-of-tree
307 + working-directory: ${{ env.CPYTHON_BUILDDIR }}
308 + run: make -j4
309 + - name: Display build info
310 + working-directory: ${{ env.CPYTHON_BUILDDIR }}
312 + - name: Remount sources writable for tests
314 + run: sudo mount $CPYTHON_RO_SRCDIR -oremount,rw
315 + - name: Tests
316 + working-directory: ${{ env.CPYTHON_BUILDDIR }}
317 + run: xvfb-run make buildbottest TESTOPTS="-j4 -uall,-cpu"
321 + runs-on: ubuntu-20.04
322 + timeout-minutes: 60
326 + fail-fast: false
335 + - uses: actions/checkout@v3
336 + - name: Restore config.cache
340 + key: ${{ github.job }}-${{ runner.os }}-${{ needs.check_source.outputs.config_hash }}
341 + - name: Register gcc problem matcher
342 + run: echo "::add-matcher::.github/problem-matchers/gcc.json"
343 + - name: Install Dependencies
344 + run: sudo ./.github/workflows/posix-deps-apt.sh
345 + - name: Configure OpenSSL env vars
350 + - name: 'Restore OpenSSL build'
351 + id: cache-openssl
355 + key: ${{ runner.os }}-multissl-openssl-${{ env.OPENSSL_VER }}
356 + - name: Install OpenSSL
357 + if: steps.cache-openssl.outputs.cache-hit != 'true'
358 …run: python3 Tools/ssl/multissltests.py --steps=library --base-directory $MULTISSL_DIR --openssl $…
359 + - name: Add ccache to PATH
362 + - name: Configure ccache action
363 + uses: hendrikmuhs/ccache-action@v1.2
364 + - name: Configure CPython
365 + run: ./configure --config-cache --with-pydebug --with-openssl=$OPENSSL_DIR
366 + - name: Build CPython
367 + run: make -j4
368 + - name: Display build info
370 + - name: SSL tests
375 + runs-on: ubuntu-20.04
376 + timeout-minutes: 60
384 + - uses: actions/checkout@v3
385 + - name: Restore config.cache
389 + key: ${{ github.job }}-${{ runner.os }}-${{ needs.check_source.outputs.config_hash }}
390 + - name: Register gcc problem matcher
391 + run: echo "::add-matcher::.github/problem-matchers/gcc.json"
392 + - name: Install Dependencies
393 + run: sudo ./.github/workflows/posix-deps-apt.sh
394 + - name: Set up GCC-10 for ASAN
395 + uses: egor-tensin/setup-gcc@v1
398 + - name: Configure OpenSSL env vars
403 + - name: 'Restore OpenSSL build'
404 + id: cache-openssl
408 + key: ${{ runner.os }}-multissl-openssl-${{ env.OPENSSL_VER }}
409 + - name: Install OpenSSL
410 + if: steps.cache-openssl.outputs.cache-hit != 'true'
411 …run: python3 Tools/ssl/multissltests.py --steps=library --base-directory $MULTISSL_DIR --openssl $…
412 + - name: Add ccache to PATH
415 + - name: Configure ccache action
416 + uses: hendrikmuhs/ccache-action@v1.2
417 + - name: Configure CPython
418 + run: ./configure --config-cache --with-address-sanitizer --without-pymalloc
419 + - name: Build CPython
420 + run: make -j4
421 + - name: Display build info
423 + - name: Tests
424 + run: xvfb-run make buildbottest TESTOPTS="-j4 -uall,-cpu"
425 diff --git a/.gitignore b/.gitignore
427 --- a/.gitignore
429 @@ -114,6 +114,7 @@ PCbuild/win32/
437 @@ -150,6 +151,3 @@ Python/frozen_modules/MANIFEST
441 -
442 -# main branch only: ABI files are not checked/maintained
443 -Doc/data/python*.abi
444 diff --git a/Include/bytesobject.h b/Include/bytesobject.h
446 --- a/Include/bytesobject.h
448 @@ -35,9 +35,9 @@ PyAPI_FUNC(PyObject *) PyBytes_FromStringAndSize(const char *, Py_ssize_t);
452 - Py_GCC_ATTRIBUTE((format(printf, 1, 0)));
455 - Py_GCC_ATTRIBUTE((format(printf, 1, 2)));
460 diff --git a/Include/fileobject.h b/Include/fileobject.h
462 --- a/Include/fileobject.h
464 @@ -30,7 +30,7 @@ PyAPI_DATA(int) Py_UTF8Mode;
467 /* A routine to check if a file descriptor can be select()-ed. */
468 -#ifdef _MSC_VER
470 /* On Windows, any socket fd can be select()-ed, no matter how high */
473 diff --git a/Include/internal/pycore_condvar.h b/Include/internal/pycore_condvar.h
475 --- a/Include/internal/pycore_condvar.h
477 @@ -5,6 +5,12 @@
490 @@ -39,6 +45,10 @@
500 /* non-emulated condition variables are provided for those that want
501 diff --git a/Include/iscygpty.h b/Include/iscygpty.h
504 --- /dev/null
506 @@ -0,0 +1,41 @@
508 + * iscygpty.h -- part of ptycheck
509 + * https://github.com/k-takata/ptycheck
511 + * Copyright (c) 2015-2017 K.Takata
548 diff --git a/Include/osdefs.h b/Include/osdefs.h
550 --- a/Include/osdefs.h
552 @@ -10,7 +10,6 @@ extern "C" {
556 -#define MAXPATHLEN 256
560 diff --git a/Include/py_curses.h b/Include/py_curses.h
562 --- a/Include/py_curses.h
564 @@ -36,6 +36,13 @@
578 diff --git a/Include/pyerrors.h b/Include/pyerrors.h
580 --- a/Include/pyerrors.h
582 @@ -315,9 +315,9 @@ PyAPI_FUNC(int) PyUnicodeTranslateError_SetReason(
586 - Py_GCC_ATTRIBUTE((format(printf, 3, 4)));
589 - Py_GCC_ATTRIBUTE((format(printf, 3, 0)));
594 diff --git a/Include/pylifecycle.h b/Include/pylifecycle.h
596 --- a/Include/pylifecycle.h
598 @@ -21,6 +21,15 @@ PyAPI_FUNC(int) Py_IsInitialized(void);
612 /* Py_PyAtExit is for the atexit module, Py_AtExit is for low-level
614 diff --git a/Include/pyport.h b/Include/pyport.h
616 --- a/Include/pyport.h
618 @@ -53,6 +53,21 @@
638 Symbols and macros to supply platform-independent interfaces to basic
640 @@ -509,12 +524,12 @@ extern char * _getpty(int *, int, mode_t, int);
644 - All windows ports, except cygwin, are handled in PC/pyconfig.h.
647 - Cygwin is the only other autoconf platform requiring special
651 -#if defined(__CYGWIN__)
656 @@ -527,21 +542,23 @@ extern char * _getpty(int *, int, mode_t, int);
660 - /* except for Cygwin to handle embedding */
661 -# if defined(__CYGWIN__)
665 -# else /* __CYGWIN__ */
668 -# endif /* __CYGWIN__ */
673 /* Under Cygwin, auto-import functions to prevent compilation */
675 /* http://docs.python.org/extending/windows.html#a-cookbook-approach */
676 -# if !defined(__CYGWIN__)
681 -# endif /* !__CYGWIN__ */
686 @@ -641,6 +658,12 @@ extern char * _getpty(int *, int, mode_t, int);
699 diff --git a/Include/pythread.h b/Include/pythread.h
701 --- a/Include/pythread.h
703 @@ -7,6 +7,12 @@ typedef void *PyThread_type_lock;
714 * backwards compatibility, ie failure -> 0, success -> 1. */
716 diff --git a/Include/sysmodule.h b/Include/sysmodule.h
718 --- a/Include/sysmodule.h
720 @@ -15,9 +15,9 @@ Py_DEPRECATED(3.11) PyAPI_FUNC(void) PySys_SetArgvEx(int, wchar_t **, int);
724 - Py_GCC_ATTRIBUTE((format(printf, 1, 2)));
727 - Py_GCC_ATTRIBUTE((format(printf, 1, 2)));
732 diff --git a/Lib/compileall.py b/Lib/compileall.py
734 --- a/Lib/compileall.py
736 @@ -38,6 +38,8 @@ def _walk_dir(dir, maxlevels, quiet=0):
745 diff --git a/Lib/ctypes/__init__.py b/Lib/ctypes/__init__.py
747 --- a/Lib/ctypes/__init__.py
749 @@ -458,7 +458,9 @@ def LoadLibrary(self, name):
753 -if _os.name == "nt":
760 diff --git a/Lib/ctypes/util.py b/Lib/ctypes/util.py
762 --- a/Lib/ctypes/util.py
764 @@ -31,6 +31,12 @@ def _get_build_version():
777 @@ -54,6 +60,9 @@ def find_msvcrt():
787 diff --git a/Lib/distutils/ccompiler.py b/Lib/distutils/ccompiler.py
789 --- a/Lib/distutils/ccompiler.py
791 @@ -9,7 +9,7 @@
795 -from distutils.util import split_quoted, execute
800 @@ -948,6 +948,8 @@ def get_default_compiler(osname=None, platform=None):
809 diff --git a/Lib/distutils/command/build_ext.py b/Lib/distutils/command/build_ext.py
811 --- a/Lib/distutils/command/build_ext.py
813 @@ -186,7 +186,7 @@ def finalize_options(self):
817 - if os.name == 'nt':
819 # the 'libs' directory is for binary installs - we assume that
821 # cross-compiling via a binary install anyway, so we let it go.
822 @@ -218,15 +218,16 @@ def finalize_options(self):
826 - if sys.platform[:6] == 'cygwin':
827 - if sys.executable.startswith(os.path.join(sys.exec_prefix, "bin")):
834 - "config"))
838 - self.library_dirs.append('.')
843 @@ -237,7 +238,7 @@ def finalize_options(self):
847 - self.library_dirs.append('.')
851 # it has to be a list of 2-tuples. All the preprocessor symbols
852 @@ -712,6 +713,20 @@ def get_libraries(self, ext):
858 + # cross-compilation (at least for mingw build).
866 + if lib.startswith('-l'):
873 diff --git a/Lib/distutils/command/install.py b/Lib/distutils/command/install.py
875 --- a/Lib/distutils/command/install.py
877 @@ -72,8 +72,8 @@
881 - 'headers': '$userbase/Python$py_version_nodot/Include/$dist_name',
882 - 'scripts': '$userbase/Python$py_version_nodot/Scripts',
888 @@ -81,7 +81,7 @@
892 - '$userbase/include/python$py_version_short$abiflags/$dist_name',
897 @@ -311,6 +311,7 @@ def finalize_options(self):
901 … 'py_version_short_plat': f'{sys.version_info[0]}.{sys.version_info[1]}-{get_platform()}' if …
905 @@ -363,7 +364,8 @@ def finalize_options(self):
907 # Convert directories from Unix /-separated syntax to the local
909 - self.convert_paths('lib', 'purelib', 'platlib',
915 diff --git a/Lib/distutils/cygwinccompiler.py b/Lib/distutils/cygwinccompiler.py
917 --- a/Lib/distutils/cygwinccompiler.py
919 @@ -44,12 +44,13 @@
920 # (ld supports -shared)
922 # (ld supports -shared)
923 +# * llvm-mingw with Clang 11 works
924 +# (lld supports -shared)
929 -from subprocess import Popen, PIPE, check_output
930 -import re
935 @@ -57,6 +58,7 @@
943 @@ -91,6 +93,7 @@ class CygwinCCompiler(UnixCCompiler):
951 @@ -109,50 +112,28 @@ def __init__(self, verbose=0, dry_run=0, force=0):
955 - self.gcc_version, self.ld_version, self.dllwrap_version = \
956 - get_versions()
957 - self.debug_print(self.compiler_type + ": gcc %s, ld %s, dllwrap %s\n" %
958 - (self.gcc_version,
959 - self.ld_version,
960 - self.dllwrap_version) )
961 -
962 - # ld_version >= "2.10.90" and < "2.13" should also be able to use
963 - # gcc -mdll instead of dllwrap
964 - # Older dllwraps had own version numbers, newer ones use the
965 - # same as the rest of binutils ( also ld )
966 - # dllwrap 2.10.90 is buggy
967 - if self.ld_version >= "2.10.90":
968 - self.linker_dll = "gcc"
969 - else:
970 - self.linker_dll = "dllwrap"
974 - # ld_version >= "2.13" support -shared so use it instead of
975 - # -mdll -static
976 - if self.ld_version >= "2.13":
977 - shared_option = "-shared"
978 - else:
979 - shared_option = "-mdll -static"
980 -
981 - # Hard-code GCC because that's what this is all about.
982 - # XXX optimization, warnings etc. should be customizable.
983 - self.set_executables(compiler='gcc -mcygwin -O -Wall',
984 - compiler_so='gcc -mcygwin -mdll -O -Wall',
985 - compiler_cxx='g++ -mcygwin -O -Wall',
986 - linker_exe='gcc -mcygwin',
994 + shared_option = "-shared"
996 + self.set_executables(compiler='%s -mcygwin -O -Wall' % self.cc,
997 + compiler_so='%s -mcygwin -mdll -O -Wall' % self.cc,
998 + compiler_cxx='%s -mcygwin -O -Wall' % self.cxx,
999 + linker_exe='%s -mcygwin' % self.cc,
1000 linker_so=('%s -mcygwin %s' %
1003 - # cygwin and mingw32 need different sets of libraries
1004 - if self.gcc_version == "2.91.57":
1005 - # cygwin shouldn't need msvcrt, but without the dlls will crash
1006 - # (gcc version 2.91.57) -- perhaps something about initialization
1007 - self.dll_libraries=["msvcrt"]
1008 - self.warn(
1009 - "Consider upgrading to a newer version of gcc")
1010 - else:
1011 - # Include the appropriate MSVC runtime library if Python was built
1012 - # with MSVC 7.0 or later.
1013 - self.dll_libraries = get_msvcr()
1020 @@ -162,6 +143,28 @@ def _compile(self, obj, src, ext, cc_args, extra_postargs, pp_opts):
1021 self.spawn(["windres", "-i", src, "-o", obj])
1028 + # * '-h dir' specifies the directory for the generated include file
1029 + # * '-r dir' specifies the target directory of the generated RC file and the binary …
1032 + # we use the source-directory for the include file and
1039 + self.spawn(['windmc'] + ['-h', h_dir, '-r', rc_dir] + [src])
1043 + self.spawn(['windres', '-i', rc_file, '-o', obj])
1046 else: # for other files use the C-compiler
1048 self.spawn(self.compiler_so + cc_args + [src, '-o', obj] +
1049 @@ -214,28 +217,21 @@ def link(self, target_desc, objects, output_filename, output_dir=None,
1051 # next add options for def-file and to creating import libraries
1053 - # dllwrap uses different options than gcc/ld
1054 - if self.linker_dll == "dllwrap":
1055 - extra_preargs.extend(["--output-lib", lib_file])
1056 - # for dllwrap we have to use a special option
1057 - extra_preargs.extend(["--def", def_file])
1058 - # we use gcc/ld here and can be sure ld is >= 2.9.10
1059 - else:
1060 - # doesn't work: bfd_close build\...\libfoo.a: Invalid operation
1061 - #extra_preargs.extend(["-Wl,--out-implib,%s" % lib_file])
1062 - # for gcc/ld the def-file is specified as any object files
1063 - objects.append(def_file)
1065 + #extra_preargs.extend(["-Wl,--out-implib,%s" % lib_file])
1066 + # for gcc/ld the def-file is specified as any object files
1074 - # otherwise we let dllwrap/ld strip the output file
1079 - if not debug:
1081 extra_preargs.append("-s")
1084 @@ -253,11 +249,16 @@ def object_filenames(self, source_filenames, strip_dir=0, output_dir=''):
1088 - # use normcase to make sure '.rc' is really '.rc' and not '.RC'
1089 - base, ext = os.path.splitext(os.path.normcase(src_name))
1090 - if ext not in (self.src_extensions + ['.rc','.res']):
1104 @@ -279,31 +280,18 @@ def __init__(self, verbose=0, dry_run=0, force=0):
1108 - # ld_version >= "2.13" support -shared so use it instead of
1109 - # -mdll -static
1110 - if self.ld_version >= "2.13":
1111 - shared_option = "-shared"
1112 - else:
1113 - shared_option = "-mdll -static"
1114 -
1115 - # A real mingw32 doesn't need to specify a different entry point,
1116 - # but cygwin 2.91.57 in no-cygwin-mode needs it.
1117 - if self.gcc_version <= "2.91.57":
1118 - entry_point = '--entry _DllMain@12'
1119 - else:
1120 - entry_point = ''
1121 + shared_option = "-shared"
1123 - if is_cygwingcc():
1126 'Cygwin gcc cannot be used with --compiler=mingw32')
1128 - self.set_executables(compiler='gcc -O -Wall',
1129 - compiler_so='gcc -mdll -O -Wall',
1130 - compiler_cxx='g++ -O -Wall',
1131 - linker_exe='gcc',
1132 - linker_so='%s %s %s'
1133 - % (self.linker_dll, shared_option,
1134 - entry_point))
1135 + self.set_executables(compiler='%s -O2 -Wall' % self.cc,
1136 + compiler_so='%s -mdll -O2 -Wall' % self.cc,
1137 + compiler_cxx='%s -O2 -Wall' % self.cxx,
1141 # Maybe we should also append -mthreads, but then the finished
1143 # (-mthreads: Support thread-safe exception handling on `Mingw32')
1144 @@ -313,7 +301,7 @@ def __init__(self, verbose=0, dry_run=0, force=0):
1148 - self.dll_libraries = get_msvcr()
1153 @@ -351,6 +339,10 @@ def check_config_h():
1164 @@ -366,38 +358,8 @@ def check_config_h():
1168 -RE_VERSION = re.compile(br'(\d+\.\d+(\.\d+)*)')
1169 -
1170 -def _find_exe_version(cmd):
1171 - """Find the version of an executable by running `cmd` in the shell.
1172 -
1173 - If the command is not found, or the output does not match
1174 - `RE_VERSION`, returns None.
1175 - """
1176 - executable = cmd.split()[0]
1177 - if find_executable(executable) is None:
1178 - return None
1179 - out = Popen(cmd, shell=True, stdout=PIPE).stdout
1180 - try:
1181 - out_string = out.read()
1182 - finally:
1183 - out.close()
1184 - result = RE_VERSION.search(out_string)
1185 - if result is None:
1186 - return None
1187 - # LooseVersion works with strings
1188 - # so we need to decode our bytes
1189 - return LooseVersion(result.group(1).decode())
1190 -
1191 -def get_versions():
1192 - """ Try to find out the versions of gcc, ld and dllwrap.
1193 -
1194 - If not possible it returns None for it.
1195 - """
1196 - commands = ['gcc -dumpversion', 'ld -v', 'dllwrap --version']
1197 - return tuple([_find_exe_version(cmd) for cmd in commands])
1199 -def is_cygwingcc():
1200 - '''Try to determine if the gcc that would be used is from cygwin.'''
1201 - out_string = check_output(['gcc', '-dumpmachine'])
1204 + out_string = check_output(shlex.split(cc) + ['-dumpmachine'])
1206 diff --git a/Lib/distutils/msvc9compiler.py b/Lib/distutils/msvc9compiler.py
1208 --- a/Lib/distutils/msvc9compiler.py
1210 @@ -291,8 +291,6 @@ def query_vcvarsall(version, arch="x86"):
1214 -if VERSION < 8.0:
1215 - raise DistutilsPlatformError("VC %0.1f is not supported by this module" % VERSION)
1219 @@ -327,6 +325,8 @@ class MSVCCompiler(CCompiler) :
1228 diff --git a/Lib/distutils/sysconfig.py b/Lib/distutils/sysconfig.py
1230 --- a/Lib/distutils/sysconfig.py
1232 @@ -64,8 +64,23 @@ def parse_config_h(fp, g=None):
1236 -_init_nt = partial(_init_non_posix, _config_vars)
1257 @@ -196,7 +211,23 @@ def customize_compiler(compiler):
1261 - if compiler.compiler_type == "unix":
1271 + _config_vars['OPT'] = "-fwrapv -O3 -Wall -Wstrict-prototypes"
1274 + _config_vars['LDSHARED'] = "gcc -shared -Wl,--enable-auto-image-base"
1280 # Perform first-time customization of compiler-related
1282 @@ -274,7 +305,7 @@ def get_python_inc(plat_specific=0, prefix=None):
1286 - if os.name == "posix":
1291 @@ -321,7 +352,7 @@ def get_python_lib(plat_specific=0, standard_lib=0, prefix=None):
1295 - if os.name == "posix":
1298 # Platform-specific modules (any module from a non-pure-Python
1300 diff --git a/Lib/distutils/tests/test_cygwinccompiler.py b/Lib/distutils/tests/test_cygwinccompiler…
1302 --- a/Lib/distutils/tests/test_cygwinccompiler.py
1304 @@ -8,7 +8,7 @@
1308 - CONFIG_H_UNCERTAIN, get_versions,
1313 @@ -81,40 +81,6 @@ def test_check_config_h(self):
1317 - def test_get_versions(self):
1318 -
1319 - # get_versions calls distutils.spawn.find_executable on
1320 - # 'gcc', 'ld' and 'dllwrap'
1321 - self.assertEqual(get_versions(), (None, None, None))
1322 -
1323 - # Let's fake we have 'gcc' and it returns '3.4.5'
1324 - self._exes['gcc'] = b'gcc (GCC) 3.4.5 (mingw special)\nFSF'
1325 - res = get_versions()
1326 - self.assertEqual(str(res[0]), '3.4.5')
1327 -
1328 - # and let's see what happens when the version
1329 - # doesn't match the regular expression
1330 - # (\d+\.\d+(\.\d+)*)
1331 - self._exes['gcc'] = b'very strange output'
1332 - res = get_versions()
1333 - self.assertEqual(res[0], None)
1334 -
1335 - # same thing for ld
1336 - self._exes['ld'] = b'GNU ld version 2.17.50 20060824'
1337 - res = get_versions()
1338 - self.assertEqual(str(res[1]), '2.17.50')
1339 - self._exes['ld'] = b'@(#)PROGRAM:ld PROJECT:ld64-77'
1340 - res = get_versions()
1341 - self.assertEqual(res[1], None)
1342 -
1343 - # and dllwrap
1344 - self._exes['dllwrap'] = b'GNU dllwrap 2.17.50 20060824\nFSF'
1345 - res = get_versions()
1346 - self.assertEqual(str(res[2]), '2.17.50')
1347 - self._exes['dllwrap'] = b'Cheese Wrap'
1348 - res = get_versions()
1349 - self.assertEqual(res[2], None)
1350 -
1354 diff --git a/Lib/distutils/unixccompiler.py b/Lib/distutils/unixccompiler.py
1356 --- a/Lib/distutils/unixccompiler.py
1358 @@ -249,9 +249,13 @@ def runtime_library_dir_option(self, dir):
1359 # -Wl whenever gcc was used in the past it is probably
1362 - # GNU ld needs an extra option to get a RUNPATH
1365 - return "-Wl,--enable-new-dtags,-R" + dir
1370 + return "-Wl,--enable-new-dtags,-R" + dir
1372 return "-Wl,-R" + dir
1374 diff --git a/Lib/distutils/util.py b/Lib/distutils/util.py
1376 --- a/Lib/distutils/util.py
1378 @@ -37,6 +37,22 @@ def get_host_platform():
1399 return 'win-amd64'
1401 @@ -130,6 +146,13 @@ def convert_path (pathname):
1415 @@ -140,6 +163,10 @@ def change_root (new_root, pathname):
1426 @@ -149,9 +176,20 @@ def change_root (new_root, pathname):
1430 - if path[0] == '\\':
1433 - return os.path.join(new_root, path)
1449 diff --git a/Lib/importlib/_bootstrap_external.py b/Lib/importlib/_bootstrap_external.py
1451 --- a/Lib/importlib/_bootstrap_external.py
1453 @@ -42,6 +42,10 @@
1459 + path_separators = path_separators[::-1]
1464 diff --git a/Lib/ntpath.py b/Lib/ntpath.py
1466 --- a/Lib/ntpath.py
1468 @@ -11,9 +11,7 @@
1472 -sep = '\\'
1474 -altsep = '/'
1478 @@ -23,6 +21,14 @@
1493 @@ -34,9 +40,33 @@
1497 - return b'\\/'
1524 - return '\\/'
1529 @@ -58,14 +88,14 @@ def normcase(s):
1533 - s = s.decode(encoding, 'surrogateescape').replace('/', '\\')
1541 - s.replace('/', '\\'))
1546 @@ -74,8 +104,8 @@ def normcase(s):
1550 - return os.fsencode(os.fsdecode(s).replace('/', '\\').lower())
1551 - return s.replace('/', '\\').lower()
1557 @@ -87,14 +117,9 @@ def normcase(s):
1561 - if isinstance(s, bytes):
1562 - sep = b'\\'
1563 - altsep = b'/'
1564 - colon_sep = b':\\'
1565 - else:
1566 - sep = '\\'
1567 - altsep = '/'
1568 - colon_sep = ':\\'
1575 @@ -106,14 +131,9 @@ def isabs(s):
1579 - if isinstance(path, bytes):
1580 - sep = b'\\'
1581 - seps = b'\\/'
1582 - colon = b':'
1583 - else:
1584 - sep = '\\'
1585 - seps = '\\/'
1586 - colon = ':'
1593 @@ -172,16 +192,10 @@ def splitdrive(p):
1597 - if isinstance(p, bytes):
1598 - sep = b'\\'
1599 - altsep = b'/'
1600 - colon = b':'
1601 - unc_prefix = b'\\\\?\\UNC\\'
1602 - else:
1603 - sep = '\\'
1604 - altsep = '/'
1605 - colon = ':'
1606 - unc_prefix = '\\\\?\\UNC\\'
1614 @@ -231,9 +245,9 @@ def split(p):
1618 - return genericpath._splitext(p, b'\\', b'/', b'.')
1621 - return genericpath._splitext(p, '\\', '/', '.')
1626 @@ -334,7 +348,7 @@ def expanduser(path):
1630 - return path
1635 @@ -361,7 +375,7 @@ def expanduser(path):
1639 - return userhome + path[i:]
1644 @@ -496,14 +510,12 @@ def expandvars(path):
1651 - sep = b'\\'
1652 - altsep = b'/'
1656 - sep = '\\'
1657 - altsep = '/'
1661 @@ -570,7 +582,7 @@ def _abspath_fallback(path):
1665 - return _getfullpathname(normpath(path))
1670 @@ -731,6 +743,7 @@ def realpath(path, *, strict=False):
1678 @@ -741,12 +754,11 @@ def realpath(path, *, strict=False):
1684 - sep = b'\\'
1688 - sep = '\\'
1692 @@ -801,13 +813,11 @@ def commonpath(paths):
1699 - sep = b'\\'
1700 - altsep = b'/'
1703 - sep = '\\'
1704 - altsep = '/'
1708 diff --git a/Lib/pathlib.py b/Lib/pathlib.py
1710 --- a/Lib/pathlib.py
1712 @@ -115,6 +115,8 @@ class _WindowsFlavour(_Flavour):
1721 diff --git a/Lib/site.py b/Lib/site.py
1723 --- a/Lib/site.py
1725 @@ -88,6 +88,12 @@
1738 @@ -273,7 +279,7 @@ def _getuserbase():
1742 - if os.name == "nt":
1747 @@ -283,14 +289,36 @@ def joinuser(*args):
1777 - ver_nodot = sys.winver.replace('.', '')
1778 - return f'{userbase}\\Python{ver_nodot}\\site-packages'
1781 + return f'{userbase}\\Python{ver_nodot}\\site-packages'
1782 + return f'{userbase}/lib/python{version[0]}.{version[1]}-{_get_platform()}/site-packages'
1785 return f'{userbase}/lib/python/site-packages'
1786 @@ -361,7 +389,7 @@ def getsitepackages(prefixes=None):
1790 - if os.sep == '/':
1795 @@ -392,7 +420,7 @@ def setquit():
1799 - if os.sep == '\\':
1801 eof = 'Ctrl-Z plus Return'
1803 eof = 'Ctrl-D (i.e. EOF)'
1804 diff --git a/Lib/ssl.py b/Lib/ssl.py
1806 --- a/Lib/ssl.py
1808 @@ -254,7 +254,7 @@ class _TLSMessageType:
1812 -if sys.platform == "win32":
1813 +if sys.platform == "win32" and sys.version.find("GCC") == -1:
1817 @@ -591,7 +591,7 @@ def _load_windows_store_certs(self, storename, purpose):
1821 - if sys.platform == "win32":
1822 + if sys.platform == "win32" and sys.version.find("GCC") == -1:
1826 diff --git a/Lib/sysconfig.py b/Lib/sysconfig.py
1828 --- a/Lib/sysconfig.py
1830 @@ -2,6 +2,7 @@
1838 @@ -47,13 +48,13 @@
1842 - 'stdlib': '{installed_base}/Lib',
1843 - 'platstdlib': '{base}/Lib',
1844 - 'purelib': '{base}/Lib/site-packages',
1845 - 'platlib': '{base}/Lib/site-packages',
1846 - 'include': '{installed_base}/Include',
1847 - 'platinclude': '{installed_base}/Include',
1848 - 'scripts': '{base}/Scripts',
1851 + 'purelib': '{base}/lib/python{py_version_short}/site-packages',
1852 + 'platlib': '{base}/lib/python{py_version_short}/site-packages',
1859 @@ -97,13 +98,18 @@
1867 # For the OS-native venv scheme, we essentially provide an alias:
1868 -if os.name == 'nt':
1879 @@ -118,7 +124,7 @@ def _getuserbase():
1883 - if os.name == "nt":
1888 @@ -134,20 +140,20 @@ def joinuser(*args):
1892 - 'stdlib': '{userbase}/Python{py_version_nodot_plat}',
1893 - 'platstdlib': '{userbase}/Python{py_version_nodot_plat}',
1894 - 'purelib': '{userbase}/Python{py_version_nodot_plat}/site-packages',
1895 - 'platlib': '{userbase}/Python{py_version_nodot_plat}/site-packages',
1896 - 'include': '{userbase}/Python{py_version_nodot_plat}/Include',
1897 - 'scripts': '{userbase}/Python{py_version_nodot_plat}/Scripts',
1900 + 'purelib': '{userbase}/lib/python{py_version_short_plat}/site-packages',
1901 + 'platlib': '{userbase}/lib/python{py_version_short_plat}/site-packages',
1907 - 'stdlib': '{userbase}/{platlibdir}/python{py_version_short}',
1908 - 'platstdlib': '{userbase}/{platlibdir}/python{py_version_short}',
1909 - 'purelib': '{userbase}/lib/python{py_version_short}/site-packages',
1910 - 'platlib': '{userbase}/lib/python{py_version_short}/site-packages',
1911 - 'include': '{userbase}/include/python{py_version_short}',
1914 + 'purelib': '{userbase}/lib/python{py_version_short_plat}/site-packages',
1915 + 'platlib': '{userbase}/lib/python{py_version_short_plat}/site-packages',
1920 @@ -277,7 +283,7 @@ def _expand_vars(scheme, vars):
1924 - if os.name == 'nt':
1929 @@ -435,6 +441,14 @@ def _parse_makefile(filename, vars=None, keep_unresolved=True):
1939 + done[k[:-4]]=v
1944 @@ -514,11 +528,30 @@ def _generate_posix_vars():
1958 + prefix = build_time_vars['BINDIR'][:-4]
1973 # Create file used for sys.path fixup -- see Modules/getpath.c
1975 @@ -541,7 +574,7 @@ def _init_non_posix(vars):
1979 - vars['VERSION'] = _PY_VERSION_SHORT_NO_DOT
1984 @@ -587,7 +620,7 @@ def parse_config_h(fp, vars=None):
1988 - if os.name == "nt":
1993 @@ -662,11 +695,15 @@ def get_config_vars(*args):
1998 + _CONFIG_VARS['py_version_short_plat'] = f'{_PY_VERSION_SHORT}-{get_platform()}'
2002 - if os.name == 'nt':
2006 - if os.name == 'posix':
2011 @@ -676,7 +713,7 @@ def get_config_vars(*args):
2015 - if os.name == 'posix':
2020 @@ -714,7 +751,7 @@ def get_config_var(name):
2024 -
2029 @@ -737,6 +774,22 @@ def get_platform():
2050 return 'win-amd64'
2052 diff --git a/Lib/test/__main__.py b/Lib/test/__main__.py
2054 --- a/Lib/test/__main__.py
2056 @@ -1,2 +1,10 @@
2067 diff --git a/Lib/test/test_bytes.py b/Lib/test/test_bytes.py
2069 --- a/Lib/test/test_bytes.py
2071 @@ -1105,7 +1105,7 @@ def test_from_format(self):
2075 - ptr_format = '0x%0{}X'.format(2 * sizeof_ptr)
2080 diff --git a/Lib/test/test_getpath.py b/Lib/test/test_getpath.py
2082 --- a/Lib/test/test_getpath.py
2084 @@ -838,6 +838,7 @@ def test_symlink_buildpath_macos(self):
2092 @@ -877,6 +878,7 @@ def __init__(self, *a, argv0=None, config=None, **kw):
2098 self["PYWINVER"] = "9.8-XY"
2100 @@ -912,6 +914,9 @@ def __missing__(self, key):
2110 @@ -1053,6 +1058,7 @@ def __init__(self, *a, argv0=None, config=None, **kw):
2118 @@ -1089,6 +1095,9 @@ def __missing__(self, key):
2128 diff --git a/Lib/test/test_httpservers.py b/Lib/test/test_httpservers.py
2130 --- a/Lib/test/test_httpservers.py
2132 @@ -442,10 +442,10 @@ def test_undecodable_filename(self):
2136 - self.assertRegex(response, f'listing for {self.base_url}/\?x=123'.encode('latin1'))
2140 - self.assertRegex(response, f'listing for {self.base_url}/\?x=\xef\xbf\xbd'.encode('latin1'…
2145 diff --git a/Lib/test/test_importlib/test_windows.py b/Lib/test/test_importlib/test_windows.py
2147 --- a/Lib/test/test_importlib/test_windows.py
2149 @@ -24,6 +24,23 @@ def get_platform():
2150 'x64' : 'win-amd64',
2151 'arm' : 'win-arm32',
2173 diff --git a/Lib/test/test_sysconfig.py b/Lib/test/test_sysconfig.py
2175 --- a/Lib/test/test_sysconfig.py
2177 @@ -17,7 +17,7 @@
2181 - _expand_vars, _get_preferred_schemes, _main)
2186 @@ -180,7 +180,7 @@ def test_nt_venv_scheme(self):
2190 - if sys.platform == 'win32':
2195 @@ -371,6 +371,10 @@ def test_user_similar(self):
2202 + f'python{sysconfig.get_python_version()}-{get_platform()}')
2203 # bpo-44860: platlib of posix_user doesn't use sys.platlibdir,
2206 diff --git a/Lib/venv/__init__.py b/Lib/venv/__init__.py
2208 --- a/Lib/venv/__init__.py
2210 @@ -302,7 +302,7 @@ def setup_python(self, context):
2214 - if self.symlinks:
2219 @@ -326,6 +326,12 @@ def setup_python(self, context):
2232 @@ -350,6 +356,7 @@ def _call_new_python(self, context, *py_args, **kwargs):
2240 diff --git a/Makefile.pre.in b/Makefile.pre.in
2242 --- a/Makefile.pre.in
2244 @@ -39,6 +39,7 @@ CXX= @CXX@
2252 @@ -123,6 +124,7 @@ PY_CORE_CFLAGS= $(PY_STDMODULE_CFLAGS) -DPy_BUILD_CORE
2254 # Strict or non-strict aliasing flags used to compile dtoa.c, see above
2259 # Machine-dependent subdirectories
2260 @@ -141,6 +143,12 @@ exec_prefix= @exec_prefix@
2264 +# Locations needed for semi-native fixup of sysconfig.
2273 @@ -158,10 +166,12 @@ BINLIBDEST= @BINLIBDEST@
2286 @@ -268,6 +278,8 @@ LIBRARY_DEPS= @LIBRARY_DEPS@
2295 @@ -284,6 +296,7 @@ LIBOBJS= @LIBOBJS@
2303 @@ -344,6 +357,7 @@ IO_OBJS= \
2311 @@ -390,7 +404,7 @@ PYTHON_OBJS= \
2315 - Python/frozenmain.o \
2320 @@ -402,6 +416,7 @@ PYTHON_OBJS= \
2328 @@ -584,8 +599,8 @@ LIBEXPAT_HEADERS= \
2332 -build_all: check-clean-src $(BUILDPYTHON) platform oldsharedmods sharedmods \
2333 - gdbhooks Programs/_testembed python-config
2334 +build_all: check-clean-src $(BUILDPYTHON) $(BUILDPYTHONW) platform oldsharedmods sharedmods \
2335 + gdbhooks Programs/_testembed python-config $(ABI3DLLLIBRARY) $(ABI3LDLIBRARY)
2336 build_wasm: check-clean-src $(BUILDPYTHON) platform oldsharedmods python-config
2339 @@ -700,9 +715,30 @@ coverage-report: regen-token regen-frozen
2340 clinic: check-clean-src $(srcdir)/Modules/_blake2/blake2s_impl.c
2341 $(PYTHON_FOR_REGEN) $(srcdir)/Tools/clinic/clinic.py --make --srcdir $(srcdir)
2344 + $(WINDRES) $(RCFLAGS) -I$(srcdir)/Include -I$(srcdir)/PC -I. $(srcdir)/PC/python_exe.rc $@
2347 + $(WINDRES) $(RCFLAGS) -I$(srcdir)/Include -I$(srcdir)/PC -I. $(srcdir)/PC/pythonw_exe.rc $@
2350 + $(WINDRES) $(RCFLAGS) -DORIGINAL_FILENAME=\\\"$(DLLLIBRARY)\\\" -I$(srcdir)/Include -I$(srcdir)/P…
2353 + $(WINDRES) $(RCFLAGS) -DORIGINAL_FILENAME=\\\"$(ABI3DLLLIBRARY)\\\" -I$(srcdir)/Include -I$(srcdi…
2356 + $(WINDRES) $(RCFLAGS) -DPY_ICON -I$(srcdir)/Include -I$(srcdir)/PC -I. $(srcdir)/PC/pylauncher.rc…
2359 + $(WINDRES) $(RCFLAGS) -DPYW_ICON -I$(srcdir)/Include -I$(srcdir)/PC -I. $(srcdir)/PC/pylauncher.r…
2362 + $(LINKCC) $(PY_CORE_LDFLAGS) $(LINKFORSHARED) -municode -mwindows -o $@ Programs/python.o $(BLDLI…
2365 -$(BUILDPYTHON): Programs/python.o $(LINK_PYTHON_DEPS)
2366 - $(LINKCC) $(PY_CORE_LDFLAGS) $(LINKFORSHARED) -o $@ Programs/python.o $(LINK_PYTHON_OBJS) $(LIBS)…
2368 + $(LINKCC) $(PY_CORE_LDFLAGS) $(LINKFORSHARED) -municode -o $@ Programs/python.o $(LINK_PYTHON_OBJ…
2371 …$(RUNSHARED) $(PYTHON_FOR_BUILD) -c 'import sys ; from sysconfig import get_platform ; print("%s-%…
2372 @@ -806,13 +842,17 @@ $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK): \
2376 -$(DLLLIBRARY) libpython$(LDVERSION).dll.a: $(LIBRARY_OBJS)
2378 if test -n "$(DLLLIBRARY)"; then \
2379 $(LDSHARED) -Wl,--out-implib=$@ -o $(DLLLIBRARY) $^ \
2380 - $(LIBS) $(MODLIBS) $(SYSLIBS); \
2386 + $(LDSHARED) -DPYTHON_DLL_NAME=\"$(DLLLIBRARY)\" $(srcdir)/PC/python3dll.c -Wl,--out-implib=$(ABI3…
2389 # wasm32-emscripten browser build
2391 # --preload-file turns a relative asset path into an absolute path.
2392 @@ -974,7 +1014,7 @@ BOOTSTRAP_HEADERS = \
2396 - $(LINKCC) $(PY_LDFLAGS_NOLTO) -o $@ $(LIBRARY_OBJS_OMIT_FROZEN) \
2397 + $(LINKCC) $(PY_LDFLAGS_NOLTO) -o $@ -municode -mwindows $(LIBRARY_OBJS_OMIT_FROZEN) \
2401 @@ -1276,9 +1316,15 @@ Python/dynload_hpux.o: $(srcdir)/Python/dynload_hpux.c Makefile
2402 -DSHLIB_EXT='"$(EXT_SUFFIX)"' \
2403 -o $@ $(srcdir)/Python/dynload_hpux.c
2406 + $(CC) -c $(PY_CORE_CFLAGS) \
2407 + -DPYD_PLATFORM_TAG='"$(PYD_PLATFORM_TAG)"' \
2408 + -o $@ $(srcdir)/Python/dynload_win.c
2411 $(CC) -c $(PY_CORE_CFLAGS) \
2412 -DABIFLAGS='"$(ABIFLAGS)"' \
2413 + -DVPATH='"$(VPATH)"' \
2415 -o $@ $(srcdir)/Python/sysmodule.c
2417 @@ -1496,6 +1542,7 @@ PYTHON_HEADERS= \
2425 @@ -1791,7 +1838,7 @@ $(DESTSHARED):
2429 - @for i in $(BINDIR) $(LIBDIR); \
2432 if test ! -d $(DESTDIR)$$i; then \
2434 @@ -1801,6 +1848,7 @@ altbininstall: $(BUILDPYTHON) @FRAMEWORKPYTHONW@
2436 if test "$(PYTHONFRAMEWORKDIR)" = "no-framework" ; then \
2442 @@ -1814,6 +1862,7 @@ altbininstall: $(BUILDPYTHON) @FRAMEWORKPYTHONW@
2443 if test -f $(LDLIBRARY) && test "$(PYTHONFRAMEWORKDIR)" = "no-framework" ; then \
2444 if test -n "$(DLLLIBRARY)" ; then \
2450 @@ -1924,6 +1973,7 @@ LIBSUBDIRS= asyncio \
2458 @@ -2223,8 +2273,9 @@ libainstall: all python-config
2460 if test -d $(LIBRARY); then :; else \
2461 if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \
2462 - if test "$(SHLIB_SUFFIX)" = .dll; then \
2463 - $(INSTALL_DATA) $(LDLIBRARY) $(DESTDIR)$(LIBPL) ; \
2464 + if test "$(SHLIB_SUFFIX)" = .dll -o "$(SHLIB_SUFFIX)" = .pyd; then \
2470 @@ -2263,16 +2314,23 @@ libainstall: all python-config
2474 +ifeq ($(shell uname -o),Msys)
2483 + MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
2485 --prefix=$(prefix) \
2486 --install-scripts=$(BINDIR) \
2487 --install-platlib=$(DESTSHARED) \
2488 - --root=$(DESTDIR)/
2489 - -rm $(DESTDIR)$(DESTSHARED)/_sysconfigdata_$(ABIFLAGS)_$(MACHDEP)_$(MULTIARCH).py
2490 - -rm -r $(DESTDIR)$(DESTSHARED)/__pycache__
2491 + --root=$(DESTDIRFINAL)
2492 + -rm $(DESTDIRFINAL)$(DESTSHARED)/_sysconfigdata_$(ABIFLAGS)_$(MACHDEP)_$(MULTIARCH).py
2493 + -rm -r $(DESTDIRFINAL)$(DESTSHARED)/__pycache__
2496 # framework-based Python. frameworkinstall installs everything, the
2497 @@ -2464,7 +2522,7 @@ clean: clean-retain-profile
2501 - -rm -f $(BUILDPYTHON) $(LIBRARY) $(LDLIBRARY) $(DLLLIBRARY) \
2502 + -rm -f $(BUILDPYTHON) $(LIBRARY) $(LDLIBRARY) $(DLLLIBRARY)$(ABI3LDLIBRARY) $(ABI3DLLLIBRARY) \
2505 -rm -rf build platform
2506 diff --git a/Misc/NEWS.d/3.11.4.rst b/Misc/NEWS.d/3.11.4.rst
2509 --- /dev/null
2511 @@ -0,0 +1,785 @@
2512 +.. date: 2023-06-01-03-24-58
2513 +.. gh-issue: 103142
2515 +.. release date: 2023-06-06
2523 +.. date: 2023-05-02-17-56-32
2524 +.. gh-issue: 99889
2533 +.. date: 2023-05-01-15-03-25
2534 +.. gh-issue: 104049
2538 +Do not expose the local on-disk location in directory indexes produced by
2543 +.. date: 2023-03-07-20-59-17
2544 +.. gh-issue: 102153
2550 +response to CVE-2023-24329. Patch by Illia Volochii.
2554 +.. date: 2023-05-31-19-35-22
2555 +.. gh-issue: 105164
2564 +.. date: 2023-05-18-13-00-21
2565 +.. gh-issue: 104615
2574 +.. date: 2023-05-14-18-56-54
2575 +.. gh-issue: 104482
2584 +.. date: 2023-05-13-06-22-52
2585 +.. gh-issue: 102818
2597 +.. date: 2023-05-12-00-19-02
2598 +.. gh-issue: 104405
2607 +.. date: 2023-05-01-12-03-52
2608 +.. gh-issue: 104018
2612 +Disallow the "z" format specifier in %-format of bytes objects.
2616 +.. date: 2023-04-28-18-57-13
2617 +.. gh-issue: 103971
2626 +.. date: 2023-04-21-17-03-14
2627 +.. gh-issue: 102310
2635 +.. date: 2023-04-21-16-12-41
2636 +.. gh-issue: 103590
2640 +Do not wrap a single exception raised from a ``try-except*`` construct in an
2645 +.. date: 2023-04-14-22-35-23
2646 +.. gh-issue: 101517
2647 +.. nonce: 5EqM-S
2655 +.. date: 2023-04-08-17-13-07
2656 +.. gh-issue: 103242
2661 +OpenSSL APIs. Patch by Dong-hee Na.
2665 +.. date: 2023-04-01-00-46-31
2666 +.. gh-issue: 102700
2670 +Allow built-in modules to be submodules. This allows submodules to be
2675 +.. date: 2023-02-12-22-40-22
2676 +.. gh-issue: 101857
2685 +.. date: 2022-11-08-12-36-25
2686 +.. gh-issue: 99184
2695 +.. date: 2022-09-27-11-59-13
2696 +.. gh-issue: 96670
2706 +.. date: 2019-12-01-12-58-31
2715 +.. date: 2023-06-02-02-38-26
2716 +.. gh-issue: 105080
2725 +.. date: 2023-05-24-09-34-23
2726 +.. gh-issue: 104874
2735 +.. date: 2023-05-17-20-03-01
2736 +.. gh-issue: 104340
2748 +.. date: 2023-05-17-08-01-36
2749 +.. gh-issue: 104372
2759 +.. date: 2023-05-16-11-02-44
2760 +.. gh-issue: 75367
2768 +.. date: 2023-05-16-10-07-16
2769 +.. gh-issue: 104536
2779 +.. date: 2023-05-11-23-03-00
2780 +.. gh-issue: 104399
2791 +.. date: 2023-05-08-20-57-17
2792 +.. gh-issue: 104307
2801 +.. date: 2023-05-08-15-39-00
2802 +.. gh-issue: 87695
2811 +.. date: 2023-05-07-19-56-45
2812 +.. gh-issue: 104265
2823 +.. date: 2023-05-01-16-43-28
2824 +.. gh-issue: 104035
2828 +Do not ignore user-defined ``__getstate__`` and ``__setstate__`` methods for
2833 +.. date: 2023-04-29-18-23-16
2834 +.. gh-issue: 103987
2838 +In :mod:`mmap`, fix several bugs that could lead to access to memory-mapped
2843 +.. date: 2023-04-27-20-03-08
2844 +.. gh-issue: 103935
2853 +.. date: 2023-04-27-00-45-41
2854 +.. gh-issue: 100370
2859 +for 32-bit builds. Patch by Erlend E. Aasland.
2863 +.. date: 2023-04-26-09-54-25
2864 +.. gh-issue: 103848
2873 +.. date: 2023-04-26-09-38-47
2874 +.. gh-issue: 103872
2882 +.. date: 2023-04-25-19-58-13
2883 +.. gh-issue: 103861
2892 +.. date: 2023-04-24-00-34-23
2893 +.. gh-issue: 103685
2902 +.. date: 2023-04-22-22-14-09
2903 +.. gh-issue: 81403
2913 +.. date: 2023-04-16-18-29-04
2914 +.. gh-issue: 103578
2924 +.. date: 2023-04-15-12-19-14
2925 +.. gh-issue: 103556
2926 +.. nonce: TEf-2m
2929 +Now creating :class:`inspect.Signature` objects with positional-only
2930 +parameter with a default followed by a positional-or-keyword parameter
2935 +.. date: 2023-04-15-11-21-38
2936 +.. gh-issue: 103559
2944 +.. date: 2023-04-12-17-59-55
2945 +.. gh-issue: 103365
2953 +.. date: 2023-04-12-13-04-16
2954 +.. gh-issue: 103472
2964 +.. date: 2023-04-11-21-38-39
2965 +.. gh-issue: 103449
2966 +.. nonce: -nxmhb
2973 +.. date: 2023-04-06-17-28-36
2974 +.. gh-issue: 103256
2981 +built-in. This could happen when, for example, your OpenSSL does not include
2987 +.. date: 2023-04-05-01-28-53
2988 +.. gh-issue: 103225
2992 +Fix a bug in :mod:`pdb` when displaying line numbers of module-level source
2997 +.. date: 2023-04-04-12-43-38
2998 +.. gh-issue: 93910
3006 +.. date: 2023-04-03-23-44-34
3007 +.. gh-issue: 102978
3017 +.. date: 2023-04-02-23-05-22
3018 +.. gh-issue: 103204
3023 +preceded by '+', or '-', or with digit-separating '_' characters. The
3028 +.. date: 2023-03-23-15-24-38
3029 +.. gh-issue: 102953
3036 +directory. See :ref:`tarfile-extraction-filter` for details.
3040 +.. date: 2023-02-09-22-24-34
3041 +.. gh-issue: 101640
3050 +.. date: 2022-09-07-09-32-07
3051 +.. gh-issue: 96522
3059 +.. date: 2022-08-27-21-41-41
3060 +.. gh-issue: 87474
3061 +.. nonce: 9X-kxt
3068 +.. date: 2023-05-28-21-01-00
3069 +.. gh-issue: 89455
3079 +.. date: 2023-05-28-19-08-42
3080 +.. gh-issue: 89412
3089 +.. date: 2023-05-25-22-34-31
3090 +.. gh-issue: 104943
3098 +.. date: 2023-05-14-12-11-28
3099 +.. gh-issue: 67056
3108 +.. date: 2023-04-25-22-58-08
3109 +.. gh-issue: 48241
3118 +.. date: 2023-05-15-02-22-44
3119 +.. gh-issue: 104494
3128 +.. date: 2023-05-14-03-00-00
3129 +.. gh-issue: 104461
3134 +variable and ``-screen`` option for toplevels are not useful on Tk for Win32
3139 +.. date: 2023-04-08-00-50-23
3140 +.. gh-issue: 103329
3149 +.. date: 2023-02-11-22-36-10
3150 +.. gh-issue: 85984
3158 +.. date: 2022-11-06-18-42-38
3159 +.. gh-issue: 75729
3168 +.. date: 2023-06-06-09-08-10
3169 +.. gh-issue: 90005
3178 +.. date: 2023-05-04-10-56-14
3179 +.. gh-issue: 104106
3180 +.. nonce: -W9BJS
3183 +Add gcc fallback of mkfifoat/mknodat for macOS. Patch by Dong-hee Na.
3187 +.. date: 2023-02-11-05-31-05
3188 +.. gh-issue: 99069
3198 +.. date: 2023-05-31-16-14-31
3199 +.. gh-issue: 105146
3208 +.. date: 2023-05-18-22-46-03
3209 +.. gh-issue: 104623
3217 +.. date: 2023-03-24-11-25-28
3218 +.. gh-issue: 102997
3226 +.. date: 2023-03-18-21-38-00
3227 +.. gh-issue: 88013
3236 +.. date: 2023-05-30-23-30-46
3237 +.. gh-issue: 103142
3245 +.. date: 2023-05-18-22-31-49
3246 +.. gh-issue: 104623
3254 +.. date: 2023-03-24-11-20-47
3255 +.. gh-issue: 102997
3263 +.. date: 2023-05-23-17-19-49
3264 +.. gh-issue: 104719
3265 +.. nonce: rvYXH-
3273 +.. date: 2023-05-17-17-32-21
3274 +.. gh-issue: 104499
3282 +.. date: 2023-05-17-15-11-11
3283 +.. gh-issue: 104496
3284 +.. nonce: wjav-y
3291 +.. date: 2023-04-30-20-01-18
3292 +.. gh-issue: 88496
3297 diff --git a/Misc/config_mingw b/Misc/config_mingw
3300 --- /dev/null
3302 @@ -0,0 +1,15 @@
3308 +# mingw-w64 functions to ignore
3316 +# force detection of winsock2 functionality - require wxp or newer
3318 diff --git a/Misc/cross_mingw32 b/Misc/cross_mingw32
3321 --- /dev/null
3323 @@ -0,0 +1,11 @@
3324 +# configure defaults for mingw32 host if cross-build
3335 diff --git a/Misc/python-config.sh.in b/Misc/python-config.sh.in
3337 --- a/Misc/python-config.sh.in
3338 +++ b/Misc/python-config.sh.in
3339 @@ -1,32 +1,44 @@
3342 -# Keep this script in sync with python-config.in
3343 -
3346 …echo "Usage: $0 --prefix|--exec-prefix|--includes|--libs|--cflags|--ldflags|--extension-suffix|--h…
3347 - exit $1
3351 +# Really, python-config.py (and thus .sh) should be called directly, but
3352 +# sometimes software (e.g. GDB) calls python-config.sh as if it were the
3353 +# Python executable, passing python-config.py as the first argument.
3362 - exit_with_usage 1
3369 - RESULT=$(dirname $(cd $(dirname "$1") && pwd -P))
3370 - if which readlink >/dev/null 2>&1 ; then
3371 - if readlink -f "$RESULT" >/dev/null 2>&1; then
3372 - RESULT=$(readlink -f "$RESULT")
3373 - fi
3374 + local RESULT=$(dirname $(cd $(dirname "$1") && pwd -P))
3376 + RESULT=$(readlink -f "$RESULT")
3379 + # we keep all paths in Windows-land since MSYS2 can handle that
3380 + # while native tools can't handle paths in MSYS2-land.
3382 + RESULT=$(cd "$RESULT" && pwd -W)
3389 -# Use sed to fix paths from their built-to locations to their installed-to
3390 +# Use sed to fix paths from their built-to locations to their installed to
3394 @@ -41,13 +53,17 @@ LIBM="@LIBM@"
3403 LIBS_EMBED="-lpython${VERSION}${ABIFLAGS} @LIBS@ $SYSLIBS"
3405 -LDLIBRARY="@LDLIBRARY@"
3413 @@ -61,7 +77,7 @@ for ARG in $*
3416 --help)
3417 - exit_with_usage 0
3420 --embed)
3422 @@ -69,7 +85,7 @@ do
3423 …--prefix|--exec-prefix|--includes|--libs|--cflags|--ldflags|--extension-suffix|--abiflags|--config…
3426 - exit_with_usage 1
3431 @@ -80,37 +96,37 @@ fi
3435 - case "$ARG" in
3437 --prefix)
3438 - echo "$prefix_real"
3439 + echo -ne "$prefix_real"
3441 --exec-prefix)
3442 - echo "$exec_prefix_real"
3443 + echo -ne "$exec_prefix_real "
3445 --includes)
3446 - echo "$INCDIR $PLATINCDIR"
3447 + echo -ne "$INCDIR $PLATINCDIR"
3449 --cflags)
3450 - echo "$INCDIR $PLATINCDIR $BASECFLAGS $CFLAGS $OPT"
3451 + echo -ne "$INCDIR $PLATINCDIR $BASECFLAGS $CFLAGS $OPT"
3453 --libs)
3454 - echo "$LIBS"
3455 + echo -ne "$LIBS"
3457 --ldflags)
3460 LIBPLUSED="-L$LIBPL"
3462 - echo "$LIBPLUSED -L$libdir $LIBS"
3463 + echo -ne "$LIBPLUSED -L$libdir $LIBS "
3465 --extension-suffix)
3466 - echo "$SO"
3467 + echo -ne "$SO "
3469 --abiflags)
3470 - echo "$ABIFLAGS"
3471 + echo -ne "$ABIFLAGS "
3473 --configdir)
3474 - echo "$LIBPL"
3475 + echo -ne "$LIBPL "
3479 diff --git a/Misc/python.pc.in b/Misc/python.pc.in
3481 --- a/Misc/python.pc.in
3483 @@ -9,5 +9,5 @@ Description: Build a C extension for Python
3487 -Libs:
3488 +Libs: -L${libdir} -lpython@VERSION@@ABIFLAGS@
3489 Cflags: -I${includedir}/python@VERSION@@ABIFLAGS@
3490 diff --git a/Modules/Setup.bootstrap.in b/Modules/Setup.bootstrap.in
3492 --- a/Modules/Setup.bootstrap.in
3494 @@ -8,15 +8,15 @@
3498 -posix posixmodule.c
3499 -_signal signalmodule.c
3501 +_signal signalmodule.c -lws2_32
3508 -_io _io/_iomodule.c _io/iobase.c _io/fileio.c _io/bytesio.c _io/bufferedio.c _io/textio.c _io/stri…
3513 @@ -33,3 +33,8 @@ _symtable symtablemodule.c
3518 +# build-in modules for windows platform:
3520 +@MODULE_MSVCRT_TRUE@msvcrt -DPy_BUILD_CORE ../PC/msvcrtmodule.c
3522 diff --git a/Modules/_ctypes/_ctypes.c b/Modules/_ctypes/_ctypes.c
3524 --- a/Modules/_ctypes/_ctypes.c
3526 @@ -3403,6 +3403,18 @@ static PPROC FindAddress(void *handle, const char *name, PyObject *type)
3535 + * - If a python module is build with gcc option --add-stdcall-alias
3538 + * - Distutil may use compiler to create def-file, to modify it as
3540 + * - Or may be just to search for function without underscore.
3545 @@ -3410,6 +3422,13 @@ static PPROC FindAddress(void *handle, const char *name, PyObject *type)
3559 diff --git a/Modules/_gdbmmodule.c b/Modules/_gdbmmodule.c
3561 --- a/Modules/_gdbmmodule.c
3563 @@ -12,7 +12,7 @@
3567 -#if defined(WIN32) && !defined(__CYGWIN__)
3572 diff --git a/Modules/_io/fileio.c b/Modules/_io/fileio.c
3574 --- a/Modules/_io/fileio.c
3576 @@ -20,6 +20,7 @@
3584 @@ -1129,7 +1130,7 @@ _io_FileIO_isatty_impl(fileio *self)
3588 - res = isatty(self->fd);
3589 + res = isatty(self->fd) || is_cygpty(self->fd);
3593 diff --git a/Modules/_localemodule.c b/Modules/_localemodule.c
3595 --- a/Modules/_localemodule.c
3597 @@ -12,6 +12,13 @@ This software comes with no warranty. Use at your own risk.
3611 diff --git a/Modules/_multiprocessing/multiprocessing.c b/Modules/_multiprocessing/multiprocessing.c
3613 --- a/Modules/_multiprocessing/multiprocessing.c
3615 @@ -172,7 +172,7 @@ static PyMethodDef module_methods[] = {
3619 -#if !defined(POSIX_SEMAPHORES_NOT_ENABLED) && !defined(__ANDROID__)
3624 diff --git a/Modules/_multiprocessing/multiprocessing.h b/Modules/_multiprocessing/multiprocessing.h
3626 --- a/Modules/_multiprocessing/multiprocessing.h
3628 @@ -21,7 +21,10 @@
3632 -# define HAVE_MP_SEMAPHORE
3640 diff --git a/Modules/_winapi.c b/Modules/_winapi.c
3642 --- a/Modules/_winapi.c
3644 @@ -41,7 +41,9 @@
3654 @@ -957,7 +959,7 @@ getattributelist(PyObject *obj, const char *name, AttributeList *attribute_list)
3658 - Py_ssize_t handle_list_size;
3663 diff --git a/Modules/_xxsubinterpretersmodule.c b/Modules/_xxsubinterpretersmodule.c
3665 --- a/Modules/_xxsubinterpretersmodule.c
3667 @@ -1765,7 +1765,7 @@ PyDoc_STRVAR(channelid_doc,
3671 - PyVarObject_HEAD_INIT(&PyType_Type, 0)
3676 diff --git a/Modules/getpath.c b/Modules/getpath.c
3678 --- a/Modules/getpath.c
3680 @@ -54,6 +54,25 @@
3698 + r = PyUnicode_FromWideChar(_Py_normpath(buffer, len), -1);
3706 @@ -88,6 +107,12 @@ getpath_basename(PyObject *Py_UNUSED(self), PyObject *args)
3709 Py_ssize_t pos = PyUnicode_FindChar(path, SEP, 0, end, -1);
3713 + pos = PyUnicode_FindChar(path, ALTSEP, 0, end, -1);
3719 @@ -104,6 +129,12 @@ getpath_dirname(PyObject *Py_UNUSED(self), PyObject *args)
3722 Py_ssize_t pos = PyUnicode_FindChar(path, SEP, 0, end, -1);
3726 + pos = PyUnicode_FindChar(path, ALTSEP, 0, end, -1);
3732 @@ -513,6 +544,7 @@ getpath_realpath(PyObject *Py_UNUSED(self) , PyObject *args)
3740 @@ -884,6 +916,11 @@ _PyConfig_InitPathConfig(PyConfig *config, int compute_path_config)
3752 @@ -910,6 +947,9 @@ _PyConfig_InitPathConfig(PyConfig *config, int compute_path_config)
3753 !funcs_to_dict(dict, config->pathconfig_warnings) ||
3762 diff --git a/Modules/getpath.py b/Modules/getpath.py
3764 --- a/Modules/getpath.py
3766 @@ -30,6 +30,7 @@
3769 # os_name -- [in] one of 'nt', 'posix', 'darwin'
3770 +# is_mingw -- [in] True if targeting MinGW
3771 # PREFIX -- [in] sysconfig.get_config_var(...)
3772 # EXEC_PREFIX -- [in] sysconfig.get_config_var(...)
3773 # PYTHONPATH -- [in] sysconfig.get_config_var(...)
3774 @@ -51,6 +52,7 @@
3775 # ENV_PYTHONHOME -- [in] getenv(...)
3776 # ENV_PYTHONEXECUTABLE -- [in] getenv(...)
3777 # ENV___PYVENV_LAUNCHER__ -- [in] getenv(...)
3778 +# ENV_MSYSTEM -- [in] getenv(...)
3781 # config -- [in/out] dict of the PyConfig structure
3782 @@ -185,8 +187,27 @@
3788 -elif os_name == 'nt':
3795 + PLATSTDLIB_LANDMARK = f'{platlibdir}/python{VERSION_MAJOR}.{VERSION_MINOR}/lib-dynload'
3811 @@ -199,6 +220,7 @@
3819 @@ -211,6 +233,8 @@ def search_up(prefix, *landmarks, test=isfile):
3828 @@ -263,10 +287,10 @@ def search_up(prefix, *landmarks, test=isfile):
3832 -if not executable and SEP in program_name:
3837 -
3841 @@ -497,15 +521,15 @@ def search_up(prefix, *landmarks, test=isfile):
3845 - if os_name == 'nt':
3853 - if os_name == 'nt':
3854 - # QUIRK: No searching for more landmarks on Windows
3860 @@ -552,6 +576,9 @@ def search_up(prefix, *landmarks, test=isfile):
3870 @@ -597,7 +624,7 @@ def search_up(prefix, *landmarks, test=isfile):
3874 - if os_name == 'nt':
3877 # gh-100320: Our PYDs are assumed to be relative to the Lib directory
3879 @@ -607,7 +634,7 @@ def search_up(prefix, *landmarks, test=isfile):
3883 - if os_name == 'nt':
3888 @@ -645,7 +672,7 @@ def search_up(prefix, *landmarks, test=isfile):
3892 - config['module_search_paths'] = py_setpath.split(DELIM)
3897 @@ -660,7 +687,7 @@ def search_up(prefix, *landmarks, test=isfile):
3901 - if os_name == 'nt':
3906 @@ -673,7 +700,7 @@ def search_up(prefix, *landmarks, test=isfile):
3910 - if os_name == 'nt' and use_environment and winreg:
3915 @@ -714,7 +741,7 @@ def search_up(prefix, *landmarks, test=isfile):
3919 - if os_name == 'nt':
3924 @@ -732,7 +759,7 @@ def search_up(prefix, *landmarks, test=isfile):
3928 - config['module_search_paths'] = pythonpath
3933 @@ -742,8 +769,8 @@ def search_up(prefix, *landmarks, test=isfile):
3935 # QUIRK: Non-Windows replaces prefix/exec_prefix with defaults when running
3937 -if os_name != 'nt' and build_prefix:
3938 - prefix = config.get('prefix') or PREFIX
3944 @@ -767,23 +794,23 @@ def search_up(prefix, *landmarks, test=isfile):
3948 - config['module_search_paths'] = pythonpath
3956 -config['program_name'] = program_name
3957 -config['home'] = home
3958 -config['executable'] = executable
3959 -config['base_executable'] = base_executable
3960 -config['prefix'] = prefix
3961 -config['exec_prefix'] = exec_prefix
3962 -config['base_prefix'] = base_prefix or prefix
3963 -config['base_exec_prefix'] = base_exec_prefix or exec_prefix
3973 -config['platlibdir'] = platlibdir
3976 -config['stdlib_dir'] = stdlib_dir or ''
3977 -config['platstdlib_dir'] = platstdlib_dir or ''
3980 diff --git a/Modules/main.c b/Modules/main.c
3982 --- a/Modules/main.c
3984 @@ -7,6 +7,7 @@
3992 @@ -92,7 +93,7 @@ static inline int config_run_code(const PyConfig *config)
3996 - return (isatty(fileno(stdin)) || config->interactive);
3997 + return (isatty(fileno(stdin)) || config->interactive || is_cygpty(fileno(stdin)));
4001 diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
4003 --- a/Modules/posixmodule.c
4005 @@ -55,6 +55,7 @@
4013 @@ -355,6 +356,32 @@ corresponding Unix manual entries for more information on calls.");
4018 +/* getlogin is detected by configure on mingw-w64 */
4020 +/* opendir is detected by configure on mingw-w64, and for some reason
4023 +un-defining, this, os.listdir will use the one which uses native
4026 +/*# define HAVE_GETCWD 1 - detected by configure*/
4032 +/*# define HAVE_EXECV 1 - detected by configure*/
4046 @@ -433,7 +460,7 @@ extern char *ctermid_r(char *);
4050 -#ifdef _MSC_VER
4055 @@ -444,7 +471,7 @@ extern char *ctermid_r(char *);
4059 -#endif /* _MSC_VER */
4064 @@ -1598,9 +1625,9 @@ win32_get_reparse_tag(HANDLE reparse_point_handle, ULONG *reparse_tag)
4068 -#elif !defined(_MSC_VER) && (!defined(__WATCOMC__) || defined(__QNX__) || defined(__VXWORKS__))
4071 -#endif /* !_MSC_VER */
4076 @@ -3820,6 +3847,7 @@ posix_getcwd(int use_bytes)
4084 @@ -4424,6 +4452,7 @@ os__getfinalpathname_impl(PyObject *module, path_t *path)
4090 if (result && path->narrow) {
4092 @@ -5507,7 +5536,7 @@ os_utime_impl(PyObject *module, path_t *path, PyObject *times, PyObject *ns,
4096 - HANDLE hFile;
4101 @@ -10234,7 +10263,7 @@ os_isatty_impl(PyObject *module, int fd)
4105 - return_value = isatty(fd);
4110 @@ -14722,7 +14751,7 @@ os__add_dll_directory_impl(PyObject *module, path_t *path)
4114 - !(AddDllDirectory = (PAddDllDirectory)GetProcAddress(
4117 !(cookie = (*AddDllDirectory)(path->wide))) {
4119 @@ -14772,7 +14801,7 @@ os__remove_dll_directory_impl(PyObject *module, PyObject *cookie)
4123 - !(RemoveDllDirectory = (PRemoveDllDirectory)GetProcAddress(
4128 diff --git a/Modules/selectmodule.c b/Modules/selectmodule.c
4130 --- a/Modules/selectmodule.c
4132 @@ -146,9 +146,9 @@ seq2set(PyObject *seq, fd_set *set, pylist fd2obj[FD_SETSIZE + 1])
4134 if (v == -1) goto finally;
4136 -#if defined(_MSC_VER)
4139 -#else /* !_MSC_VER */
4144 @@ -156,7 +156,7 @@ seq2set(PyObject *seq, fd_set *set, pylist fd2obj[FD_SETSIZE + 1])
4148 -#endif /* _MSC_VER */
4153 diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c
4155 --- a/Modules/socketmodule.c
4157 @@ -274,7 +274,7 @@ shutdown(how) -- shut down traffic in one or both directions\n\
4161 -#ifdef MS_WINDOWS
4166 @@ -305,7 +305,7 @@ shutdown(how) -- shut down traffic in one or both directions\n\
4170 -#endif /* MS_WINDOWS */
4175 @@ -404,6 +404,10 @@ remove_unusable_flags(PyObject *m)
4186 diff --git a/Modules/socketmodule.h b/Modules/socketmodule.h
4188 --- a/Modules/socketmodule.h
4190 @@ -68,8 +68,10 @@ struct SOCKADDR_BTH_REDEF {
4201 diff --git a/Modules/timemodule.c b/Modules/timemodule.c
4203 --- a/Modules/timemodule.c
4205 @@ -783,7 +783,7 @@ time_strftime(PyObject *module, PyObject *args)
4209 -#if defined(_MSC_VER) || (defined(__sun) && defined(__SVR4)) || defined(_AIX) || defined(__VXWORKS…
4214 diff --git a/Objects/fileobject.c b/Objects/fileobject.c
4216 --- a/Objects/fileobject.c
4218 @@ -3,6 +3,7 @@
4226 @@ -387,7 +388,7 @@ stdprinter_isatty(PyStdPrinter_Object *self, PyObject *Py_UNUSED(ignored))
4230 - res = isatty(self->fd);
4231 + res = isatty(self->fd) || is_cygpty(self->fd);
4235 diff --git a/PC/_testconsole.c b/PC/_testconsole.c
4237 --- a/PC/_testconsole.c
4239 @@ -10,7 +10,7 @@
4243 -#include "..\modules\_io\_iomodule.h"
4248 @@ -108,7 +108,7 @@ _testconsole_read_output_impl(PyObject *module, PyObject *file)
4252 -#include "clinic\_testconsole.c.h"
4257 diff --git a/PC/launcher.c b/PC/launcher.c
4259 --- a/PC/launcher.c
4261 @@ -155,12 +155,12 @@ static wchar_t * get_env(wchar_t * key)
4265 -#define PYTHON_EXECUTABLE L"pythonw.exe"
4271 -#define PYTHON_EXECUTABLE L"python.exe"
4276 @@ -925,7 +925,7 @@ static COMMAND path_command;
4280 - size_t varsize;
4285 @@ -942,18 +942,23 @@ static COMMAND * find_on_path(wchar_t * name)
4288 /* No extension - search using registered extensions. */
4289 - rc = _wdupenv_s(&pathext, &varsize, L"PATHEXT");
4290 - if (rc == 0) {
4291 - extension = wcstok_s(pathext, L";", &context);
4292 - while (extension) {
4293 - len = SearchPathW(NULL, name, extension, MSGSIZE, path_command.value, NULL);
4294 - if (len) {
4295 - result = &path_command;
4296 - break;
4300 + /* No extension - search using registered extensions. */
4312 - extension = wcstok_s(NULL, L";", &context);
4315 - free(pathext);
4319 @@ -1913,7 +1918,7 @@ process(int argc, wchar_t ** argv)
4323 - cb = fread_s(buffer, sizeof(buffer), sizeof(buffer[0]),
4328 diff --git a/PC/msvcrtmodule.c b/PC/msvcrtmodule.c
4330 --- a/PC/msvcrtmodule.c
4332 @@ -22,7 +22,9 @@
4342 diff --git a/PC/pylauncher.rc b/PC/pylauncher.rc
4344 --- a/PC/pylauncher.rc
4346 @@ -12,17 +12,17 @@
4350 -1 ICON DISCARDABLE "icons\python.ico"
4353 -1 ICON DISCARDABLE "icons\pythonw.ico"
4356 -1 ICON DISCARDABLE "icons\launcher.ico"
4357 -2 ICON DISCARDABLE "icons\py.ico"
4358 -3 ICON DISCARDABLE "icons\pyc.ico"
4359 -4 ICON DISCARDABLE "icons\pyd.ico"
4360 -5 ICON DISCARDABLE "icons\python.ico"
4361 -6 ICON DISCARDABLE "icons\pythonw.ico"
4362 -7 ICON DISCARDABLE "icons\setup.ico"
4372 1 USAGE "launcher-usage.txt"
4373 @@ -64,4 +64,4 @@ BEGIN
4377 -END
4380 diff --git a/PC/python3dll.c b/PC/python3dll.c
4382 --- a/PC/python3dll.c
4384 @@ -3,6 +3,7 @@
4392 @@ -13,6 +14,13 @@
4399 + asm(".section .drectve\n\t.ascii \" -export:" #name "=\\\"" PYTHON_DLL_NAME "." #name "\\\" \"…
4401 + asm(".section .drectve\n\t.ascii \" -export:" #name "=\\\"" PYTHON_DLL_NAME "." #name "\\\",DA…
4406 diff --git a/PC/python_exe.rc b/PC/python_exe.rc
4408 --- a/PC/python_exe.rc
4410 @@ -12,7 +12,7 @@
4414 -1 ICON DISCARDABLE "icons\python.ico"
4419 diff --git a/PC/pythonw_exe.rc b/PC/pythonw_exe.rc
4421 --- a/PC/pythonw_exe.rc
4423 @@ -12,7 +12,7 @@
4427 -1 ICON DISCARDABLE "icons\pythonw.ico"
4432 diff --git a/PC/winreg.c b/PC/winreg.c
4434 --- a/PC/winreg.c
4436 @@ -18,6 +18,25 @@
4462 @@ -806,6 +825,7 @@ Reg2Py(BYTE *retDataBuf, DWORD retDataSize, DWORD typ)
4470 diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c
4472 --- a/Python/bltinmodule.c
4474 @@ -1,6 +1,7 @@
4475 /* Built-in functions */
4482 @@ -2135,7 +2136,7 @@ builtin_input_impl(PyObject *module, PyObject *prompt)
4486 - tty = fd == fileno(stdin) && isatty(fd);
4491 @@ -2148,7 +2149,7 @@ builtin_input_impl(PyObject *module, PyObject *prompt)
4495 - tty = fd == fileno(stdout) && isatty(fd);
4500 diff --git a/Python/dynamic_annotations.c b/Python/dynamic_annotations.c
4502 --- a/Python/dynamic_annotations.c
4504 @@ -27,7 +27,7 @@
4508 -#ifdef _MSC_VER
4513 diff --git a/Python/dynload_win.c b/Python/dynload_win.c
4515 --- a/Python/dynload_win.c
4517 @@ -4,6 +4,7 @@
4525 @@ -170,8 +171,7 @@ static char *GetPythonImport (HINSTANCE hModule)
4529 -static int
4530 -_Py_CheckPython3(void)
4535 @@ -224,7 +224,21 @@ dl_funcptr _PyImport_FindSharedFuncptrWindows(const char *prefix,
4539 - _Py_CheckPython3();
4558 @@ -248,9 +262,7 @@ dl_funcptr _PyImport_FindSharedFuncptrWindows(const char *prefix,
4562 - hDLL = LoadLibraryExW(wpathname, NULL,
4563 - LOAD_LIBRARY_SEARCH_DEFAULT_DIRS |
4564 - LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR);
4569 diff --git a/Python/fileutils.c b/Python/fileutils.c
4571 --- a/Python/fileutils.c
4573 @@ -1,4 +1,5 @@
4579 @@ -71,7 +72,7 @@ _Py_device_encoding(int fd)
4583 - valid = isatty(fd);
4588 @@ -1809,12 +1810,12 @@ _Py_write_impl(int fd, const void *buf, size_t count, int gil_held)
4592 - if (isatty(fd)) {
4598 - if (isatty(fd)) {
4603 @@ -2004,19 +2005,31 @@ int
4616 - HRESULT hr = PathCchSkipRoot(path, &tail);
4617 - if (FAILED(hr) || path == tail) {
4623 - if (tail == &path[1] && (path[0] == SEP || path[0] == ALTSEP)) {
4629 - if (tail == &path[2] && path[1] == L':') {
4631 // Exclude drive-relative paths (e.g. C:filename.ext)
4639 @@ -2049,7 +2062,11 @@ _Py_abspath(const wchar_t *path, wchar_t **abspath_p)
4643 - return _PyOS_getfullpathname(path, abspath_p);
4645 + return -1;
4647 + *abspath_p = _Py_normpath(*abspath_p, -1);
4651 cwd[Py_ARRAY_LENGTH(cwd) - 1] = 0;
4652 @@ -2093,6 +2110,8 @@ join_relfile(wchar_t *buffer, size_t bufsize,
4660 return -1;
4661 @@ -2195,11 +2214,16 @@ _Py_normpath_and_size(wchar_t *path, Py_ssize_t size, Py_ssize_t *normsize)
4663 wchar_t lastC = L'\0'; // the last ljusted character, p2[-1] in most cases
4672 -#define IS_SEP(x) (*(x) == SEP || *(x) == ALTSEP)
4675 -#define IS_SEP(x) (*(x) == SEP)
4680 @@ -2210,7 +2234,7 @@ _Py_normpath_and_size(wchar_t *path, Py_ssize_t size, Py_ssize_t *normsize)
4684 - lastC = SEP;
4689 @@ -2224,13 +2248,13 @@ _Py_normpath_and_size(wchar_t *path, Py_ssize_t size, Py_ssize_t *normsize)
4693 - *p2++ = SEP;
4694 - *p2++ = SEP;
4700 --sepCount;
4701 - *p2++ = lastC = SEP;
4706 @@ -2243,7 +2267,7 @@ _Py_normpath_and_size(wchar_t *path, Py_ssize_t size, Py_ssize_t *normsize)
4709 minP2 = p2 - 1; // Absolute path has SEP at minP2
4710 - lastC = SEP;
4715 @@ -2251,18 +2275,18 @@ _Py_normpath_and_size(wchar_t *path, Py_ssize_t size, Py_ssize_t *normsize)
4719 - if (c == ALTSEP) {
4720 - c = SEP;
4725 - if (lastC == SEP) {
4732 - while (p3 != minP2 && *--p3 == SEP) { }
4733 - while (p3 != minP2 && *(p3 - 1) != SEP) { --p3; }
4734 + while (p3 != minP2 && *--p3 == sep) { }
4735 + while (p3 != minP2 && *(p3 - 1) != sep) { --p3; }
4739 @@ -2271,7 +2295,7 @@ _Py_normpath_and_size(wchar_t *path, Py_ssize_t size, Py_ssize_t *normsize)
4743 - } else if (p3[0] == SEP) {
4748 @@ -2282,7 +2306,7 @@ _Py_normpath_and_size(wchar_t *path, Py_ssize_t size, Py_ssize_t *normsize)
4752 - } else if (c == SEP) {
4757 @@ -2292,7 +2316,7 @@ _Py_normpath_and_size(wchar_t *path, Py_ssize_t size, Py_ssize_t *normsize)
4761 - while (--p2 != minP2 && *p2 == SEP) {
4762 + while (--p2 != minP2 && *p2 == sep) {
4766 diff --git a/Python/frozenmain.c b/Python/frozenmain.c
4768 --- a/Python/frozenmain.c
4770 @@ -3,6 +3,7 @@
4778 @@ -71,7 +72,7 @@ Py_FrozenMain(int argc, char **argv)
4782 - if (inspect && isatty((int)fileno(stdin))) {
4787 diff --git a/Python/getcompiler.c b/Python/getcompiler.c
4789 --- a/Python/getcompiler.c
4791 @@ -7,10 +7,40 @@
4795 -#if defined(__clang__)
4799 -#define COMPILER "[GCC " __VERSION__ "]"
4834 diff --git a/Python/initconfig.c b/Python/initconfig.c
4836 --- a/Python/initconfig.c
4838 @@ -176,7 +176,7 @@ static const char usage_envvars[] =
4839 "PYTHONVERBOSE : trace import statements (-v)\n"
4840 "PYTHONWARNINGS=arg : warning control (-W arg)\n";
4842 -#if defined(MS_WINDOWS)
4847 diff --git a/Python/iscygpty.c b/Python/iscygpty.c
4850 --- /dev/null
4852 @@ -0,0 +1,185 @@
4854 + * iscygpty.c -- part of ptycheck
4855 + * https://github.com/k-takata/ptycheck
4857 + * Copyright (c) 2015-2017 K.Takata
4897 + * http://www.microsoft.com/en-us/download/details.aspx?id=22599
4959 + (wcsncmp((s), (prefix), sizeof(prefix) / sizeof(WCHAR) - 1) == 0)
4968 + int size = sizeof(FILE_NAME_INFO) + sizeof(WCHAR) * (MAX_PATH - 1);
4987 + * '\{cygwin,msys}-XXXXXXXXXXXXXXXX-ptyN-{from,to}-master' */
4989 + nameinfo->FileName[nameinfo->FileNameLength / sizeof(WCHAR)] = L'\0';
4990 + p = nameinfo->FileName;
4991 + if (is_wprefix(p, L"\\cygwin-")) { /* Cygwin */
4993 + } else if (is_wprefix(p, L"\\msys-")) { /* MSYS and MSYS2 */
4999 + while (*p && isxdigit(*p)) /* Skip 16-digit hexadecimal. */
5001 + if (is_wprefix(p, L"-pty")) {
5010 + if (is_wprefix(p, L"-from-master")) {
5012 + } else if (is_wprefix(p, L"-to-master")) {
5038 diff --git a/Python/pathconfig.c b/Python/pathconfig.c
5040 --- a/Python/pathconfig.c
5042 @@ -2,7 +2,7 @@
5046 -#include "osdefs.h" // DELIM
5051 @@ -18,6 +18,158 @@
5089 + /* https://msdn.microsoft.com/en-gb/library/windows/desktop/aa365247%28v=vs.85%29.aspx
5143 + /* https://msdn.microsoft.com/en-gb/library/windows/desktop/aa365247%28v=vs.85%29.aspx
5210 @@ -317,6 +469,7 @@ _Py_SetProgramFullPath(const wchar_t *program_full_path)
5218 @@ -509,7 +662,7 @@ _PyPathConfig_ComputeSysPath0(const PyWideStringList *argv, PyObject **path0_p)
5222 - PyObject *path0_obj = PyUnicode_FromWideChar(path0, n);
5223 + PyObject *path0_obj = PyUnicode_FromWideChar(_Py_normpath(path0, -1), n);
5225 return -1;
5227 diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c
5229 --- a/Python/pylifecycle.c
5231 @@ -31,6 +31,7 @@
5239 @@ -2954,7 +2955,7 @@ Py_Exit(int sts)
5243 - if (isatty((int)fileno(fp)))
5248 @@ -2967,7 +2968,7 @@ Py_FdIsInteractive(FILE *fp, const char *filename)
5252 - if (isatty((int)fileno(fp))) {
5257 diff --git a/Python/sysmodule.c b/Python/sysmodule.c
5259 --- a/Python/sysmodule.c
5261 @@ -43,7 +43,7 @@ Data members:
5265 -#ifdef MS_COREDLL
5270 @@ -2923,7 +2923,7 @@ _PySys_InitCore(PyThreadState *tstate, PyObject *sysdict)
5274 -#ifdef MS_COREDLL
5279 diff --git a/Python/thread_nt.h b/Python/thread_nt.h
5281 --- a/Python/thread_nt.h
5283 @@ -360,8 +360,9 @@ PyThread_release_lock(PyThread_type_lock aLock)
5287 - if (!(aLock && LeaveNonRecursiveMutex((PNRMUTEX) aLock)))
5294 diff --git a/Python/traceback.c b/Python/traceback.c
5296 --- a/Python/traceback.c
5298 @@ -323,7 +323,7 @@ _Py_FindSourceFile(PyObject *filename, char* namebuf, size_t namelen, PyObject *
5302 - tail = strrchr(filepath, SEP);
5307 diff --git a/configure.ac b/configure.ac
5309 --- a/configure.ac
5311 @@ -202,9 +202,11 @@ AC_SUBST([FREEZE_MODULE])
5315 +NATIVE_PYTHON_SEARCH_PATH_MINGW=`echo $host | grep -Eq 'mingw*' && echo "$MINGW_PREFIX/bin" || ech…
5318 - [python3])
5324 @@ -545,6 +547,9 @@ then
5325 *-*-cygwin*)
5328 + *-*-mingw*)
5331 *-*-vxworks*)
5334 @@ -580,6 +585,7 @@ then
5342 @@ -605,6 +611,9 @@ if test "$cross_compiling" = yes; then
5344 wasm32-*-* | wasm64-*-*)
5347 + *-*-mingw*)
5352 @@ -612,6 +621,14 @@ if test "$cross_compiling" = yes; then
5355 _PYTHON_HOST_PLATFORM="$MACHDEP${_host_cpu:+-$_host_cpu}"
5367 @@ -723,6 +740,65 @@ then
5371 +# On 'semi-native' build systems (MSYS*/Cygwin targeting MinGW-w64)
5381 +# prefixes matching the non-b2h versions with the b2h equivalents.
5384 +# - in the 'semi-native' scenario only that is.)
5391 + mingw*) $1=$(cd $$2 && pwd -W) ;;
5397 + mingw*) $1=$(cygpath -w -m $$2) ;;
5425 + *-*-mingw*) INITSYS=nt;;
5430 # Record the configure-time value of MACOSX_DEPLOYMENT_TARGET,
5433 @@ -1163,6 +1239,28 @@ AC_CACHE_CHECK([for -Wl,--no-as-needed], [ac_cv_wl_no_as_needed], [
5440 + *-*-mingw*) py_config=mingw ;;
5442 +if test -n "$py_config" ; then
5447 +# initialize defaults for cross-builds
5453 + if test -f "$srcdir/Misc/cross_$py_config" ; then
5462 @@ -1275,6 +1373,7 @@ AC_ARG_WITH([suffix],
5470 @@ -1298,6 +1397,10 @@ else
5481 @@ -1475,6 +1578,11 @@ if test $enable_shared = "yes"; then
5488 + BLDLIBRARY='-L. -lpython$(LDVERSION)'
5492 BLDLIBRARY='-Wl,-R,$(LIBDIR) -L. -lpython$(LDVERSION)'
5493 @@ -1525,6 +1633,9 @@ else # shared is disabled
5503 @@ -1618,6 +1729,10 @@ AC_SUBST(LINK_PYTHON_OBJS)
5513 if test -z "$ARFLAGS"
5514 @@ -2498,6 +2613,53 @@ then
5519 +dnl - GCC 4.4+ for mingw* require and use posix threads(pthreads-w32)
5520 +dnl - Host may contain installed pthreads-w32.
5521 +dnl - On windows platform only NT-thread model is supported.
5522 +dnl To avoid miss detection scipt first will check for NT-thread model
5526 +dnl If NT-thread model is enabled script skips some checks that
5531 +AC_MSG_CHECKING([for --with-nt-threads])
5532 +AC_ARG_WITH(nt-threads,
5533 + AS_HELP_STRING([--with-nt-threads], [build with windows threads (default is system-dep…
5542 + *-*-mingw*) with_nt_threads=yes;;
5549 +AC_MSG_CHECKING([whether linking with nt-threads work])
5554 + [AC_MSG_ERROR([failed to link with nt-threads])])
5568 @@ -2609,6 +2771,8 @@ int main(void){
5577 @@ -2629,6 +2793,10 @@ elif test "$ac_cv_pthread" = "yes"
5579 CXX="$CXX -pthread"
5588 @@ -2663,11 +2831,11 @@ AC_DEFINE(STDC_HEADERS, 1, [Define to 1 if you have the ANSI C header files…
5592 - alloca.h asm/types.h bluetooth.h conio.h crypt.h direct.h dlfcn.h endian.h errno.h fcntl.h grp.h…
5596 - linux/tipc.h linux/wait.h netdb.h netinet/in.h netpacket/packet.h poll.h process.h pthread.h pty…
5597 - sched.h setjmp.h shadow.h signal.h spawn.h stropts.h sys/audioio.h sys/bsdtty.h sys/devpoll.h \
5603 @@ -2675,9 +2843,24 @@ AC_CHECK_HEADERS([ \
5609 + *-*-mingw*) ;;
5625 # bluetooth/bluetooth.h has been known to not compile with -std=c99.
5628 @@ -2852,6 +3035,10 @@ dnl LFS does not work with Emscripten 3.1
5632 +dnl Activate on windows platforms (32&64-bit) where off_t(4) < fpos_t(8)
5639 @@ -2882,6 +3069,10 @@ elif test "$ac_cv_pthread" = "yes"
5640 then CC="$CC -pthread"
5644 + dnl skip check for pthread_t if NT-thread model is enabled
5650 @@ -2913,7 +3104,7 @@ AS_VAR_IF([ac_cv_pthread_key_t_is_arithmetic_type], [yes], [
5654 -
5659 @@ -3089,6 +3280,9 @@ if test -z "$SHLIB_SUFFIX"; then
5669 @@ -3218,6 +3412,10 @@ then
5671 LDSHARED="gcc -shared -Wl,--enable-auto-image-base"
5672 LDCXXSHARED="g++ -shared -Wl,--enable-auto-image-base";;
5674 + LDSHARED='$(CC) -shared -Wl,--enable-auto-image-base'
5675 + LDCXXSHARED='$(CXX) -shared -Wl,--enable-auto-image-base'
5680 @@ -3341,6 +3539,11 @@ then
5682 LINKFORSHARED='-Wl,-export-dynamic';;
5685 + *-*-mingw*)
5687 + LINKFORSHARED="-Wl,--stack,2000000";;
5692 @@ -3385,7 +3588,12 @@ AC_MSG_RESULT($SHLIBS)
5696 -AC_CHECK_LIB(dl, dlopen) # Dynamic linking for SunOS/Solaris and SYSV
5699 + *-*-mingw*) ;;
5703 AC_CHECK_LIB(dld, shl_load) # Dynamic linking for HP-UX
5706 @@ -3448,16 +3656,30 @@ AS_VAR_IF([have_uuid], [missing], [
5711 + dnl do not search for sem_init if NT-thread model is enabled
5722 + *-*-mingw*)
5731 LIBS="-lintl $LIBS"])
5737 @@ -3645,7 +3867,7 @@ else
5740 if test "$with_system_ffi" = "yes" && test -n "$PKG_CONFIG"; then
5741 - LIBFFI_INCLUDEDIR="`"$PKG_CONFIG" libffi --cflags-only-I 2>/dev/null | sed -e 's/^-I//;s/ *$//…
5742 + LIBFFI_INCLUDEDIR="`"$PKG_CONFIG" libffi --cflags-only-I 2>/dev/null | sed -e 's/^-I//;s/ .*$/…
5746 @@ -3780,6 +4002,12 @@ AS_CASE([$ac_sys_system],
5752 + [MINGW], [SOCKET_LIBS="-lws2_32 -liphlpapi"],
5757 PY_CHECK_EMSCRIPTEN_PORT([LIBSQLITE3], [-sUSE_SQLITE3])
5759 @@ -4042,6 +4270,18 @@ AS_VAR_IF([with_dbmliborder], [error], [
5764 + *-*-mingw*)
5765 + CFLAGS_NODIST="$CFLAGS_NODIST -D_WIN32_WINNT=0x0602";;
5772 + *-*-mingw*) USE_WIN32_MODULE=;;
5778 @@ -4076,6 +4316,11 @@ then
5779 CXX="$CXX -pthread"
5788 if test ! -z "$withval" -a -d "$withval"
5789 then LDFLAGS="$LDFLAGS -L$withval"
5790 @@ -4450,11 +4695,14 @@ AC_MSG_RESULT($with_freelists)
5791 AC_MSG_CHECKING(for --with-c-locale-coercion)
5792 AC_ARG_WITH(c-locale-coercion,
5793 AS_HELP_STRING([--with-c-locale-coercion],
5794 - [enable C locale coercion to a UTF-8 based locale (default is yes)]))
5795 + [enable C locale coercion to a UTF-8 based locale (default is yes on Unix, no on Win…
5797 if test -z "$with_c_locale_coercion"
5799 - with_c_locale_coercion="yes"
5801 + *-*-mingw*) with_c_locale_coercion="no";;
5807 @@ -4555,12 +4803,36 @@ then
5812 + *-*-mingw*)
5815 + CFLAGS_NODIST="$CFLAGS_NODIST -DPY3_DLLNAME='L\"$DLLLIBRARY\"'"
5818 + CFLAGS_NODIST="$CFLAGS_NODIST -DMS_DLL_ID='\"${VERSION}-32\"'"
5821 + CFLAGS_NODIST="$CFLAGS_NODIST -DMS_DLL_ID='\"${VERSION}-arm32\"'"
5824 + CFLAGS_NODIST="$CFLAGS_NODIST -DMS_DLL_ID='\"${VERSION}-arm64\"'"
5827 + CFLAGS_NODIST="$CFLAGS_NODIST -DMS_DLL_ID='\"$VERSION\"'"
5843 # MACHDEP_OBJS can be set to platform-specific object files needed by Python
5844 @@ -4580,13 +4852,22 @@ else
5849 + dnl GCC(mingw) 4.4+ require and use posix threads(pthreads-w32)
5850 + dnl and host may contain installed pthreads-w32.
5851 + dnl Skip checks for some functions declared in pthreads-w32 if
5852 + dnl NT-thread model is enabled.
5863 - getgrnam_r getgrouplist getgroups gethostname getitimer getloadavg getlogin \
5868 @@ -4599,7 +4880,7 @@ AC_CHECK_FUNCS([ \
5872 - setresuid setreuid setsid setuid setvbuf shutdown sigaction sigaltstack \
5877 @@ -4829,7 +5110,13 @@ PKG_CHECK_MODULES([LIBLZMA], [liblzma], [have_liblzma=yes], [
5881 -AC_DEFUN([PY_CHECK_NETDB_FUNC], [PY_CHECK_FUNC([$1], [#include <netdb.h>])])
5892 @@ -4838,13 +5125,19 @@ PY_CHECK_NETDB_FUNC([getservbyport])
5912 @@ -4945,6 +5238,9 @@ WITH_SAVE_ENV([
5917 + *-*-mingw*) ;;
5921 LIBS="$LIBS -lrt"
5922 @@ -4965,6 +5261,8 @@ AC_CHECK_FUNCS(clock_settime, [], [
5931 @@ -5163,18 +5461,33 @@ if test $ac_cv_header_time_altzone = yes; then
5937 -AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <netdb.h>]], [[struct addrinfo a]])],
5948 - AC_DEFINE(HAVE_ADDRINFO, 1, [struct addrinfo (netdb.h)])
5954 -# include <sys/types.h>
5955 -# include <sys/socket.h>]], [[struct sockaddr_storage s]])],
5969 @@ -5508,6 +5821,10 @@ dnl actually works. For FreeBSD versions <= 7.2,
5974 + dnl skip posix semaphores test if NT-thread model is enabled
5980 @@ -5541,6 +5858,14 @@ AS_VAR_IF([ac_cv_posix_semaphores_enabled], [no], [
5985 + dnl Skip test if NT-thread model is enabled.
5986 + dnl NOTE the test case below fail for pthreads-w32 as:
5987 + dnl - SEM_FAILED is not defined;
5988 + dnl - sem_open is a stub;
5989 + dnl - sem_getvalue work(!).
5995 @@ -5577,7 +5902,10 @@ AS_VAR_IF([ac_cv_broken_sem_getvalue], [yes], [
5999 -AC_CHECK_DECLS([RTLD_LAZY, RTLD_NOW, RTLD_GLOBAL, RTLD_LOCAL, RTLD_NODELETE, RTLD_NOLOAD, RTLD_DEE…
6001 + *-*-mingw*) ;;
6007 @@ -5664,6 +5992,71 @@ esac
6017 +# gcc + x86_64 + msvcrt = cp{version number}-x86_64
6018 +# gcc + i686 + msvcrt = cp{version number}-i686
6019 +# gcc + x86_64 + ucrt = cp{version number}-x86_64-ucrt
6020 +# clang + x86_64 + ucrt = cp{version number}-x86_64-clang
6021 +# clang + i686 + ucrt = cp{version number}-i686-clang
6025 + *-*-mingw*)
6042 + i686-*-mingw*)
6043 + if test -n "${cc_is_clang}"; then
6054 + x86_64-*-mingw*)
6055 + if test -n "${cc_is_clang}"; then
6066 + aarch64-*-mingw*)
6069 + armv7-*-mingw*)
6079 @@ -5696,7 +6089,12 @@ if test "$Py_DEBUG" = 'true' -a "$with_trace_refs" != "yes"; then
6083 -EXT_SUFFIX=.${SOABI}${SHLIB_SUFFIX}
6084 +VERSION_NO_DOTS=$(echo $LDVERSION | tr -d .)
6085 +if test -n "${PYD_PLATFORM_TAG}"; then
6086 + EXT_SUFFIX=".cp${VERSION_NO_DOTS}-${PYD_PLATFORM_TAG}${SHLIB_SUFFIX}"
6093 @@ -5704,7 +6102,7 @@ AC_MSG_RESULT($LDVERSION)
6097 -if test -n "$ANDROID_API_LEVEL" -o "$MACHDEP" = "cygwin"; then
6098 +if test -n "$ANDROID_API_LEVEL" -o "$MACHDEP" = "cygwin" -o "$MACHDEP" = "win32"; then
6099 LIBPYTHON="-lpython${VERSION}${ABIFLAGS}"
6102 @@ -6073,11 +6471,16 @@ then
6106 +if test -n "$PKG_CONFIG"; then
6107 + NCURSESW_INCLUDEDIR="`"$PKG_CONFIG" ncursesw --cflags-only-I 2>/dev/null | sed -e 's/^-I//;s/ …
6115 -if test "$cross_compiling" = no; then
6116 - CPPFLAGS="$CPPFLAGS -I/usr/include/ncursesw"
6117 -fi
6118 +CPPFLAGS="$CPPFLAGS -I$NCURSESW_INCLUDEDIR"
6122 @@ -6243,7 +6646,10 @@ fi
6126 - [Define to `int' if <sys/socket.h> does not define.]),[
6134 @@ -6333,6 +6739,27 @@ do
6139 + *-*-mingw*)
6144 + dnl (-I. at end is workaround for setup.py logic)
6145 + CPPFLAGS="-I\$(srcdir)/PC $CPPFLAGS -I."
6153 + *-*-mingw*)
6154 + dnl 'PC/frozen_dllmain.c' - not yet
6162 @@ -6354,6 +6781,10 @@ SRCDIRS="\
6167 + *-*-mingw*) SRCDIRS="$SRCDIRS PC";;
6172 if test ! -d $dir; then
6173 @@ -6362,6 +6793,38 @@ for dir in $SRCDIRS; do
6179 + *-*-mingw*)
6180 + LIBS="$LIBS -lversion -lshlwapi -lpathcch -lbcrypt"
6183 + awk_extra_flag="--non-decimal-data"
6196 + RCFLAGS="$RCFLAGS -DFIELD3=$FIELD3 -O COFF"
6199 + i686*) RCFLAGS="$RCFLAGS --target=pe-i386" ;;
6200 + x86_64*) RCFLAGS="$RCFLAGS --target=pe-x86-64" ;;
6209 # Availability of -O2:
6210 AC_CACHE_CHECK([for -O2], [ac_cv_compile_o2], [
6212 @@ -6971,7 +7434,6 @@ PY_STDLIB_MOD_SIMPLE([_json])
6216 -PY_STDLIB_MOD_SIMPLE([_posixsubprocess])
6220 @@ -6982,7 +7444,7 @@ PY_STDLIB_MOD_SIMPLE([_zoneinfo])
6224 - [], [test "$ac_cv_func_sem_unlink" = "yes"],
6225 + [], [test "$ac_cv_func_sem_unlink" = "yes" -o "$MACHDEP" = "win32"],
6226 [-I\$(srcdir)/Modules/_multiprocessing])
6229 @@ -7002,11 +7464,15 @@ PY_STDLIB_MOD([fcntl],
6230 [], [test "$ac_cv_header_sys_ioctl_h" = "yes" -a "$ac_cv_header_fcntl_h" = "yes"],
6233 - [], [test "$ac_cv_header_sys_mman_h" = "yes" -a "$ac_cv_header_sys_stat_h" = "yes"])
6235 + -a "$ac_cv_header_sys_stat_h" = "yes"
6236 + -o "$MACHDEP" = "win32"]))
6239 -a "$ac_cv_header_sys_types_h" = "yes"
6240 - -a "$ac_cv_header_netinet_in_h" = "yes"]))
6241 + -a "$ac_cv_header_netinet_in_h" = "yes"
6242 + -o "$MACHDEP" = "win32"]),
6246 PY_STDLIB_MOD([grp], [], [test "$ac_cv_func_getgrgid" = yes -o "$ac_cv_func_getgrgid_r" = yes])
6247 @@ -7021,6 +7487,7 @@ PY_STDLIB_MOD([_scproxy],
6248 PY_STDLIB_MOD([spwd], [], [test "$ac_cv_func_getspent" = yes -o "$ac_cv_func_getspnam" = yes])
6255 @@ -7083,25 +7550,35 @@ PY_STDLIB_MOD([_lzma], [], [test "$have_liblzma" = yes],
6259 - [$OPENSSL_INCLUDES], [$OPENSSL_LDFLAGS $OPENSSL_LDFLAGS_RPATH $OPENSSL_LIBS])
6260 + [$OPENSSL_INCLUDES], [$OPENSSL_LDFLAGS $OPENSSL_LDFLAGS_RPATH $OPENSSL_LIBS -lws2_32])
6268 + [-lmsi -lcabinet -lrpcrt4])
6270 + [-lwinmm])
6272 + [-lws2_32])
6277 -PY_STDLIB_MOD([_testinternalcapi], [test "$TEST_MODULES" = yes])
6278 +PY_STDLIB_MOD([_testinternalcapi], [test "$TEST_MODULES" = yes], [], [-DPY3_DLLNAME="\"$DLLLIBRARY…
6280 -PY_STDLIB_MOD([_testimportmultiple], [test "$TEST_MODULES" = yes], [test "$ac_cv_func_dlopen" = ye…
6281 -PY_STDLIB_MOD([_testmultiphase], [test "$TEST_MODULES" = yes], [test "$ac_cv_func_dlopen" = yes])
6285 -PY_STDLIB_MOD([_ctypes_test], [test "$TEST_MODULES" = yes], [test "$ac_cv_func_dlopen" = yes], [],…
6286 …_MOD([_ctypes_test], [test "$TEST_MODULES" = yes], [test "$have_dynamic_loading" = yes], [], [-lm])
6291 -PY_STDLIB_MOD([xxlimited], [test "$with_trace_refs" = "no"], [test "$ac_cv_func_dlopen" = yes])
6292 -PY_STDLIB_MOD([xxlimited_35], [test "$with_trace_refs" = "no"], [test "$ac_cv_func_dlopen" = yes])
6298 diff --git a/mingw_ignorefile.txt b/mingw_ignorefile.txt
6301 --- /dev/null
6303 @@ -0,0 +1,42 @@
6346 diff --git a/mingw_smoketests.py b/mingw_smoketests.py
6349 --- /dev/null
6351 @@ -0,0 +1,358 @@
6397 + # https://github.com/msys2-contrib/cpython-mingw/issues/32
6416 + # https://github.com/msys2/MINGW-packages/issues/9319
6534 + # Make sure --enable-loadable-sqlite-extensions is used
6551 + # This will not work in in-tree build
6556 + "-c",
6575 + self.assertTrue(sysconfig.get_config_var('SOABI').startswith("cpython-"))
6584 + self.assertEqual(sys.winver, ".".join(map(str, sys.version_info[:2])) + '-32')
6586 + self.assertEqual(sys.winver, ".".join(map(str, sys.version_info[:2])) + '-arm64')
6588 + self.assertEqual(sys.winver, ".".join(map(str, sys.version_info[:2])) + '-arm32')
6626 + subprocess.check_call([sys.executable, "-m", "ensurepip", "--user"])
6665 + -1,
6678 + [sys.executable, "-c", "import struct"],
6683 + "-m",
6692 + "-m",
6699 + [sys.executable, "-c", "import cwrapper"],
6710 diff --git a/pyconfig.h.in b/pyconfig.h.in
6712 --- a/pyconfig.h.in
6714 @@ -60,7 +60,7 @@
6718 -/* struct addrinfo (netdb.h) */
6723 @@ -1521,6 +1521,9 @@
6733 @@ -1836,7 +1839,7 @@
6737 -/* Define to `int' if <sys/socket.h> does not define. */
6742 diff --git a/setup.py b/setup.py
6744 --- a/setup.py
6746 @@ -77,9 +77,24 @@ def get_platform():
6757 + command_in_sh = 'sh.exe -c "%s"' % command.replace("\\", "\\\\")
6767 -MS_WINDOWS = (HOST_PLATFORM == 'win32')
6772 @@ -687,7 +702,7 @@ def check_extension_import(self, ext):
6774 # Debian/Ubuntu multiarch support.
6776 - tmpfile = os.path.join(self.build_temp, 'multiarch')
6781 @@ -712,7 +727,7 @@ def add_multiarch_paths(self):
6784 opt = '-t' + sysconfig.get_config_var('HOST_GNU_TYPE')
6785 - tmpfile = os.path.join(self.build_temp, 'multiarch')
6790 @@ -774,7 +789,7 @@ def add_search_path(line):
6794 - tmpfile = os.path.join(self.build_temp, 'ccpaths')
6798 # bpo-38472: With a German locale, GCC returns "gcc-Version 9.1.0
6799 @@ -796,14 +811,25 @@ def add_cross_compiling_paths(self):
6803 - for d in line.strip().split("=")[1].split(":"):
6806 - if '/gcc/' not in d:
6814 + ret = run_command('%s -print-search-dirs >%s' % (CC, tmpfile))
6827 @@ -849,10 +875,10 @@ def configure_compiler(self):
6835 - self.add_multiarch_paths()
6839 @@ -898,7 +924,7 @@ def init_inc_lib_dirs(self):
6840 if HOST_PLATFORM == 'hp-ux11':
6843 - if MACOS:
6845 # This should work on any unixy platform ;-)
6846 # If the user has bothered specifying additional -I and -L flags
6848 @@ -970,11 +996,15 @@ def detect_simple_extensions(self):
6852 - self.addext(Extension('_socket', ['socketmodule.c']))
6859 - self.addext(Extension('select', ['selectmodule.c']))
6864 # Memory-mapped files (also works on Win32).
6866 @@ -1033,12 +1063,15 @@ def detect_test_extensions(self):
6878 - tmpfile = os.path.join(self.build_temp, 'readline_termcap_lib')
6883 @@ -1101,6 +1134,8 @@ def detect_readline_curses(self):
6892 @@ -1124,8 +1159,7 @@ def detect_readline_curses(self):
6896 - if not CROSS_COMPILING:
6897 - curses_includes.append('/usr/include/ncursesw')
6902 @@ -1209,7 +1243,7 @@ def detect_dbm_gdbm(self):
6904 dbm_order = [arg.split('=')[-1] for arg in dbm_args][-1].split(":")
6906 - dbm_order = "gdbm:ndbm:bdb".split(":")
6911 @@ -1282,6 +1316,19 @@ def detect_platform_specific_exts(self):
6912 # macOS-only, needs SystemConfiguration and CoreFoundation framework
6915 + # Windows-only modules
6931 @@ -1329,9 +1376,10 @@ def detect_multiprocessing(self):
6935 - ):
6938 - self.addext(Extension('_multiprocessing', multiprocessing_srcs))
6944 @@ -1414,11 +1462,16 @@ def detect_ctypes(self):
6948 - libraries=[],
6957 - self.addext(Extension('_ctypes_test', ['_ctypes/_ctypes_test.c']))
6963 @@ -1568,7 +1621,7 @@ def copy_scripts(self):
6967 - os.rename(filename, newfilename)