Update to 3.14.2#205
Merged
Merged
Conversation
Co-authored-by: Naveen M K <[email protected]> Co-authored-by: Алексей <[email protected]> Co-authored-by: Christoph Reiter <[email protected]>
This is used throughout the Python code but is not defined when compiling with Mingw-w64 compilers, so define it. In MSVC these are defined in PC/pyconfig.h, we have to define it manually because pyconfig.h is created by autotools. Co-authored-by: Алексей <[email protected]> Co-authored-by: Christoph Reiter <[email protected]> Co-authored-by: Naveen M K <[email protected]>
Co-authored-by: Алексей <[email protected]>
Co-authored-by: Алексей <[email protected]> Co-authored-by: Christoph Reiter <[email protected]>
Largefile is supported on Windows. Co-authored-by: Naveen M K <[email protected]> Co-authored-by: Алексей <[email protected]> Co-authored-by: Christoph Reiter <[email protected]>
Co-authored-by: Naveen M K <[email protected]>
Also, build `nt` module instead of `posix` when compiling with MINGW. Co-authored-by: Naveen M K <[email protected]> Co-authored-by: Алексей <[email protected]>
Co-authored-by: Алексей <[email protected]>
Co-authored-by: Naveen M K <[email protected]>
Add PYD_PLATFORM_TAG to distinguish C extensions built with different MinGW toolchain configurations. The tag follows the format: mingw_<cpu_arch>_<c_runtime>_<toolchain> Where: - cpu_arch: x86_64, i686, aarch64, or armv7 - c_runtime: ucrt or msvcrt - toolchain: gnu or llvm This prevents loading extensions built with incompatible configurations. Co-authored-by: Naveen M K <[email protected]>
Co-authored-by: Алексей <[email protected]>
Try to match the format defined in pycore_importdl.h for Windows
MS_DLL_ID is used for sys.winver and Windows registry keys
Co-authored-by: Алексей <[email protected]>
Co-authored-by: Алексей <[email protected]> Co-authored-by: Naveen M K <[email protected]>
Co-authored-by: Алексей <[email protected]> Co-authored-by: lovetox <[email protected]>
Co-authored-by: Алексей <[email protected]> Co-authored-by: Naveen M K <[email protected]>
This would possibly fix building wheels when mingw python is used and would be unique to each python same as EXT_SUFFIX. Signed-off-by: Naveen M K <[email protected]>
Co-authored-by: Алексей <[email protected]> Co-authored-by: Naveen M K <[email protected]>
This is the case used in MINGW Co-authored-by: Алексей <[email protected]>
Co-authored-by: Алексей <[email protected]> Co-authored-by: Christoph Reiter <[email protected]>
Just like with MSVC. This fixes a test in test_ctypes.
Co-authored-by: Алексей <[email protected]> Co-authored-by: Christoph Reiter <[email protected]>
This should avoid mixing of user site-packages between python from various environments. Previously, the user site-packages should be located at `~/.local/lib/python3.12` for all environment including 32-bits variants which caused problems with 64-bit trying to load 32-bit extensions. Now this path will be changed to `~/.local/lib/python3.12-<platform tag here>`, for example, in CLANG64 this would be `~/.local/lib/python3.12-mingw_x86_64_ucrt_llvm`. Fixes #40
Co-authored-by: Алексей <[email protected]> Co-authored-by: Christoph Reiter <[email protected]>
so there is no bash required to run it on Windows
os needs ntpath.sep, so define it before importing os Co-authored-by: Алексей <[email protected]> Co-authored-by: Christoph Reiter <[email protected]> Co-authored-by: cat <[email protected]> Co-authored-by: Naveen M K <[email protected]>
The casing and pathseps have to match, so a cross compiler on Linux find the files. Co-authored-by: Martin Storsjö <[email protected]>
for example the wmi module
Invalid "Libs:" value Also it contains "-L." which is only used at build time by makesetup and shouldn't be exposed. python#138800
This is fallout from LIBPYTHON not inluding -L. anymore
Like on Linux we provide python3.x globally, so make sure those also exist in the venv, so when python3.x is run the venv version is launched and not the global one.
copy the logic from callproc.c
So we get different names for debug and free threaded builds
setuptools doesn't play along
value copied from the MSVC build config
We require autoreconf to run for the build, and we use Ubuntu 24.04 for llvm which only ships 2.71. It looks like there wasno real reason for upstream to require it, so this should be fine.
it's tied to the build system used and not Windows, and it's used in various places we use such as python-config, so improve the condition.
It passing "notfound" as the path parameter and not as the fallback, so this never could have worked with cross compiling. Fixes CXX being set to "g++" instead of the cross compiler. Should be upstreamed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
git range-diff v3.13.11..mingw-v3.13.11 v3.14.2..wip/mingw-v3.14.2@@ configure.ac: elif test "$ac_cv_pthread" = "yes" @@ configure.ac: AC_CHECK_HEADERS([ \ alloca.h asm/types.h bluetooth.h conio.h direct.h dlfcn.h endian.h errno.h fcntl.h grp.h \ io.h langinfo.h libintl.h libutil.h linux/auxvec.h sys/auxv.h linux/fs.h linux/limits.h linux/memfd.h \ - linux/random.h linux/soundcard.h \ + linux/netfilter_ipv4.h linux/random.h linux/soundcard.h linux/sched.h \ - linux/tipc.h linux/wait.h netdb.h net/ethernet.h netinet/in.h netpacket/packet.h poll.h process.h pthread.h pty.h \ - sched.h setjmp.h shadow.h signal.h spawn.h stropts.h sys/audioio.h sys/bsdtty.h sys/devpoll.h \ + linux/tipc.h linux/wait.h netdb.h net/ethernet.h netinet/in.h netpacket/packet.h poll.h process.h pty.h \ @@ configure.ac: if test "$ac_sys_system" = "Linux-android"; then +fi AC_CHECK_FUNCS([ \ accept4 alarm bind_textdomain_codeset chmod chown clock closefrom close_range confstr \ - copy_file_range ctermid dup dup3 execv explicit_bzero explicit_memset \ + copy_file_range ctermid dladdr dup dup3 execv explicit_bzero explicit_memset \ @@ configure.ac: dnl actually works. For FreeBSD versions <= 7.2, dnl the kernel module that provides POSIX semaphores dnl isn't loaded by default, so an attempt to callMS_WINDOWS(and others) when compiling with MINGWMACHDEPandplatformon MINGW@@ Commit message Co-authored-by: Christoph Reiter <[email protected]> ## configure.ac ## -@@ configure.ac: dnl LFS does not work with Emscripten 3.1 - AS_CASE([$ac_sys_system], - [Emscripten], [have_largefile_support="no"] - ) +@@ configure.ac: if test "$ac_cv_sizeof_off_t" -gt "$ac_cv_sizeof_long" -a \ + else + have_largefile_support="no" + fi +dnl Activate on windows platforms (32&64-bit) where off_t(4) < fpos_t(8) +AS_CASE([$ac_sys_system], + [MINGW], [have_largefile_support="yes"]PC/toCPPFLAGSand toSRCDIRSon Mingw@@ configure.ac: PY_STDLIB_MOD([mmap], PY_STDLIB_MOD([_socket], [], m4_flatten([test "$ac_cv_header_sys_socket_h" = "yes" -a "$ac_cv_header_sys_types_h" = "yes" -- -a "$ac_cv_header_netinet_in_h" = "yes"])) +- -a "$ac_cv_header_netinet_in_h" = "yes"]), [], [$SOCKET_LIBS]) + -a "$ac_cv_header_netinet_in_h" = "yes" -+ -o "$MACHDEP" = "win32"]), -+ [], [$SOCKET_LIBS]) ++ -o "$MACHDEP" = "win32"]), [], [$SOCKET_LIBS]) dnl platform specific extensions PY_STDLIB_MOD([grp], [], ## pyconfig.h.in ## @@ - /* Define to 1 if you have the `acosh' function. */ + /* Define to 1 if you have the 'acosh' function. */ #undef HAVE_ACOSH -/* struct addrinfo (netdb.h) */ +/* struct addrinfo */ #undef HAVE_ADDRINFO - /* Define to 1 if you have the `alarm' function. */ + /* Define to 1 if you have the 'alarm' function. */ @@ - /* Define to `unsigned int' if <sys/types.h> does not define. */ + /* Define as 'unsigned int' if <stddef.h> doesn't define. */ #undef size_t -/* Define to 'int' if <sys/socket.h> does not define. */ +/* Define to `int' if <sys/socket.h> or <ws2tcpip.h> does not define. */ #undef socklen_t - /* Define to `int' if <sys/types.h> doesn't define. */ + /* Define as 'int' if <sys/types.h> doesn't define. */@@ Lib/sysconfig/__init__.py: def parse_config_h(fp, vars=None): if _PYTHON_BUILD: - if os.name == "nt": + if os.name == "nt" and not sys._is_mingw: - inc_dir = os.path.dirname(sys._base_executable) + inc_dir = os.path.join(_PROJECT_BASE, 'PC') else: inc_dir = _PROJECT_BASE +@@ Lib/sysconfig/__init__.py: def _init_config_vars(): + except AttributeError: + abiflags = '' + +- if os.name == 'posix': ++ if os.name == 'posix' or sys._is_mingw: + _init_posix(_CONFIG_VARS) + # If we are cross-compiling, load the prefixes from the Makefile instead. + if '_PYTHON_PROJECT_BASE' in os.environ: @@ Lib/sysconfig/__init__.py: def _init_config_vars(): except AttributeError: _CONFIG_VARS['py_version_nodot_plat'] = '' @@ Lib/sysconfig/__init__.py: def _init_config_vars(): + if os.name == 'nt' and not sys._is_mingw: _init_non_posix(_CONFIG_VARS) _CONFIG_VARS['VPATH'] = sys._vpath -- if os.name == 'posix': -+ if os.name == 'posix' or sys._is_mingw: - _init_posix(_CONFIG_VARS) if _HAS_USER_BASE: - # Setting 'userbase' is done below the call to the @@ Lib/sysconfig/__init__.py: def _init_config_vars(): # Always convert srcdir to an absolute pathget_platform()method in sysconfig@@ Lib/sysconfig/__main__.py: def _parse_makefile(filename, vars=None, keep_unresol return vars ## Makefile.pre.in ## -@@ Makefile.pre.in: exec_prefix= @exec_prefix@ +@@ Makefile.pre.in: host_exec_prefix= @host_exec_prefix@ # Install prefix for data files datarootdir= @datarootdir@@@ Metadata ## Commit message ## mingw: prefer unix sep if MSYSTEM environment variable + os needs ntpath.sep, so define it before importing os + Co-authored-by: Алексей <[email protected]> Co-authored-by: Christoph Reiter <[email protected]> Co-authored-by: cat <[email protected]> @@ Lib/ntpath.py defpath = '.;C:\\bin' devnull = 'nul' -@@ - import genericpath - from genericpath import * - +-import os + import sys ++ +if sys._use_alt_sep: + sep = '/' + altsep = '\\' @@ Lib/ntpath.py +bsep = str.encode(sep) +baltsep = str.encode(altsep) + - __all__ = ["normcase","isabs","join","splitdrive","splitroot","split","splitext", - "basename","dirname","commonprefix","getsize","getmtime", - "getatime","getctime", "islink","exists","lexists","isdir","isfile", ++import os + import genericpath + from genericpath import * + @@ def _get_bothseps(path): @@ Lib/ntpath.py +def _get_altsep(path): + if isinstance(path, bytes): + return baltsep - else: -- return '\\/' ++ else: + return altsep + +def _get_colon(path): @@ Lib/ntpath.py +def _get_unc_prefix(path): + if isinstance(path, bytes): + return b'\\\\?\\UNC\\' -+ else: + else: +- return '\\/' + return '\\\\?\\UNC\\' # Normalize the case of a pathname and map slashes to backslashes.@@ Commit message * include MINGW and UCRT * include things like "64 bit (AMD64)" for compat with the MSVC build + * We include "GCC" even for Clang builds since various code out there + checks for GCC in the string to detect a MINGW build. ## Python/getcompiler.c ## @@ @@ Python/getcompiler.c + +#if defined(__clang__) +# if defined(_UCRT) -+# define COMPILER COMP_SEP "[" ARCH_PREFIX "Clang UCRT " __clang_version__ ARCH_SUFFIX "]" ++// Some code checks for "GCC" in the compiler string, so we include it here. ++# define COMPILER COMP_SEP "[" ARCH_PREFIX "Clang UCRT " __clang_version__ ARCH_SUFFIX " (GCC)]" +# else -+# define COMPILER COMP_SEP "[" ARCH_PREFIX "Clang " __clang_version__ ARCH_SUFFIX "]" ++# define COMPILER COMP_SEP "[" ARCH_PREFIX "Clang " __clang_version__ ARCH_SUFFIX " (GCC)]" +# endif +#else +# if defined(_UCRT)@@ configure.ac: AC_DEFINE([STDC_HEADERS], [1], - alloca.h asm/types.h bluetooth.h conio.h direct.h dlfcn.h endian.h errno.h fcntl.h grp.h \ + alloca.h asm/types.h bluetooth.h conio.h direct.h endian.h errno.h fcntl.h grp.h \ io.h langinfo.h libintl.h libutil.h linux/auxvec.h sys/auxv.h linux/fs.h linux/limits.h linux/memfd.h \ - linux/random.h linux/soundcard.h \ + linux/netfilter_ipv4.h linux/random.h linux/soundcard.h linux/sched.h \ linux/tipc.h linux/wait.h netdb.h net/ethernet.h netinet/in.h netpacket/packet.h poll.h process.h pty.h \ @@ configure.ac: AC_CHECK_HEADERS([ \ sys/types.h sys/uio.h sys/un.h sys/utsname.h sys/wait.h sys/xattr.h sysexits.h syslog.h \@@ Commit message Fixes #36 ## configure.ac ## -@@ configure.ac: AC_MSG_RESULT([$with_freelists]) +@@ configure.ac: AC_MSG_RESULT([$with_pymalloc]) AC_MSG_CHECKING([for --with-c-locale-coercion]) AC_ARG_WITH( [c-locale-coercion],@@ Commit message - test_sysconfig.py: fix tests related to mingw ## Lib/test/test_getpath.py ## -@@ Lib/test/test_getpath.py: def test_explicitly_set_stdlib_dir(self): +@@ Lib/test/test_getpath.py: def test_PYTHONHOME_in_venv(self): ENV_PYTHONHOME="", ENV_PYTHONEXECUTABLE="", ENV___PYVENV_LAUNCHER__="",Python/sysmodule.c_bootstrap_python@@ Modules/getpath.c: getpath_dirname(PyObject *Py_UNUSED(self), PyObject *args) + } +#endif if (pos < 0) { - return PyUnicode_FromStringAndSize(NULL, 0); + return Py_GetConstant(Py_CONSTANT_EMPTY_STR); } @@ Modules/getpath.c: getpath_realpath(PyObject *Py_UNUSED(self) , PyObject *args) @@ Modules/getpath.py: def search_up(prefix, *landmarks, test=isfile): library_dir = dirname(library) @@ Modules/getpath.py: def search_up(prefix, *landmarks, test=isfile): else: - pythonpath.append(joinpath(prefix, ZIP_LANDMARK)) + pythonpath.append(joinpath(base_prefix, ZIP_LANDMARK)) - if os_name == 'nt' and use_environment and winreg: + if (not is_mingw) and os_name == 'nt' and use_environment and winreg: @@ Modules/getpath.py: def search_up(prefix, *landmarks, test=isfile): # as the default value of each subkey of # {HKCU,HKLM}\Software\Python\PythonCore\{winver}\PythonPath @@ Modules/getpath.py: def search_up(prefix, *landmarks, test=isfile): - if not platstdlib_dir and exec_prefix: - platstdlib_dir = joinpath(exec_prefix, PLATSTDLIB_LANDMARK) + if not platstdlib_dir and base_exec_prefix: + platstdlib_dir = joinpath(base_exec_prefix, PLATSTDLIB_LANDMARK) - if os_name == 'nt': + if os_name == 'nt' and (not is_mingw): @@ Modules/getpath.py: def search_up(prefix, *landmarks, test=isfile): @@ Modules/getpath.py: def search_up(prefix, *landmarks, test=isfile): - # QUIRK: Non-Windows replaces prefix/exec_prefix with defaults when running # in build directory. This happens after pythonpath calculation. + # Virtual environments using the build directory Python still keep their prefix. -if os_name != 'nt' and build_prefix: -- prefix = config.get('prefix') or PREFIX +if (os_name != 'nt' or is_mingw) and build_prefix: -+ prefix = config.get('prefix') or abspath(PREFIX) - exec_prefix = config.get('exec_prefix') or EXEC_PREFIX or prefix + if not venv_prefix: +- prefix = config.get('prefix') or PREFIX ++ prefix = config.get('prefix') or abspath(PREFIX) + exec_prefix = config.get('exec_prefix') or EXEC_PREFIX or prefix +- base_prefix = config.get('base_prefix') or PREFIX ++ base_prefix = config.get('base_prefix') or abspath(PREFIX) + base_exec_prefix = config.get('base_exec_prefix') or EXEC_PREFIX or base_prefix @@ Modules/getpath.py: def search_up(prefix, *landmarks, test=isfile): @@ Modules/getpath.py: def search_up(prefix, *landmarks, test=isfile): -config['base_executable'] = base_executable -config['prefix'] = prefix -config['exec_prefix'] = exec_prefix --config['base_prefix'] = base_prefix or prefix --config['base_exec_prefix'] = base_exec_prefix or exec_prefix +-config['base_prefix'] = base_prefix +-config['base_exec_prefix'] = base_exec_prefix +config['program_name'] = _normpath(program_name) +config['home'] = _normpath(home) +config['executable'] = _normpath(executable) +config['base_executable'] = _normpath(base_executable) +config['prefix'] = _normpath(prefix) +config['exec_prefix'] = _normpath(exec_prefix) -+config['base_prefix'] = _normpath(base_prefix or prefix) -+config['base_exec_prefix'] = _normpath(base_exec_prefix or exec_prefix) ++config['base_prefix'] = _normpath(base_prefix) ++config['base_exec_prefix'] = _normpath(base_exec_prefix) -config['platlibdir'] = platlibdir +config['platlibdir'] = _normpath(platlibdir)@@ Commit message build: Don't build _posixsubprocess on Windows. ## configure.ac ## -@@ configure.ac: PY_STDLIB_MOD_SIMPLE([_json]) +@@ configure.ac: PY_STDLIB_MOD_SIMPLE([_heapq]) + PY_STDLIB_MOD_SIMPLE([_json]) PY_STDLIB_MOD_SIMPLE([_lsprof]) - PY_STDLIB_MOD_SIMPLE([_opcode]) PY_STDLIB_MOD_SIMPLE([_pickle]) -PY_STDLIB_MOD_SIMPLE([_posixsubprocess]) PY_STDLIB_MOD_SIMPLE([_queue]) PY_STDLIB_MOD_SIMPLE([_random]) - PY_STDLIB_MOD_SIMPLE([select]) + PY_STDLIB_MOD_SIMPLE([_remote_debugging]) @@ configure.ac: PY_STDLIB_MOD([_scproxy], [], [-framework SystemConfiguration -framework CoreFoundation]) PY_STDLIB_MOD([syslog], [], [test "$ac_cv_header_syslog_h" = yes])@@ Modules/clinic/_ssl.c.h: exit: #define _SSL_ENUM_CERTIFICATES_METHODDEF ## configure.ac ## -@@ configure.ac: PY_STDLIB_MOD([_lzma], [], [test "$have_liblzma" = yes], +@@ configure.ac: PY_STDLIB_MOD([_zstd], [], [test "$have_libzstd" = yes], dnl OpenSSL bindings PY_STDLIB_MOD([_ssl], [], [test "$ac_cv_working_openssl_ssl" = yes],winsock.hwhen checking for netdb function@@ configure.ac: AC_CHECK_FUNCS([ \ sigfillset siginterrupt sigpending sigrelse sigtimedwait sigwait \ sigwaitinfo snprintf splice strftime strlcpy strsignal symlinkat sync \ sysconf tcgetpgrp tcsetpgrp tempnam timegm times tmpfile \ -@@ configure.ac: PKG_CHECK_MODULES([LIBLZMA], [liblzma], [have_liblzma=yes], [ +@@ configure.ac: PKG_CHECK_MODULES([LIBZSTD], [libzstd >= 1.4.5], [have_libzstd=yes], [ ]) dnl PY_CHECK_NETDB_FUNC(FUNCTION)mmapmodule on win32/to\\before passing though pathcch functions@@ configure.ac: _RESTORE_VAR([CFLAGS]) [PYDEBUG_CFLAGS="-Og"]) +PYDEBUG_CFLAGS="-D_DEBUG $PYDEBUG_CFLAGS" - # tweak OPT based on compiler and platform, only if the user didn't set - # it on the command line + # gh-120688: WASI uses -O3 in debug mode to support more recursive calls + if test "$ac_sys_system" = "WASI"; then@@ configure.ac: AS_CASE([$ac_sys_system], + ], [QNX*], [PY_STDLIB_MOD_SET_NA([_scproxy])], [FreeBSD*], [PY_STDLIB_MOD_SET_NA([_scproxy])], - [Emscripten|WASI], [ + [Emscripten], [_uuidon MINGWincompatible-pointer-typesa warning@@ Commit message for now, make it as warning to avoid build failure ## configure.ac ## -@@ configure.ac: case $GCC in - yes) +@@ configure.ac: fi + AS_VAR_IF([ac_cv_gcc_compat], [yes], [ CFLAGS_NODIST="$CFLAGS_NODIST -std=c11" + # GCC 14 and later error out with incompatible-pointer-types@@ Commit message The casing and pathseps have to match, so a cross compiler on Linux find the files. + Co-authored-by: Martin Storsjö <[email protected]> + + ## Modules/_ctypes/ctypes.h ## +@@ + #endif + + #ifdef MS_WIN32 +-#include <Unknwn.h> // for IUnknown interface ++#include <unknwn.h> // for IUnknown interface + #endif + + typedef struct { + ## Modules/posixmodule.c ## @@ Modules/posixmodule.c: os_setpgrp_impl(PyObject *module)@@ Commit message ## Include/internal/pycore_time.h ## @@ Include/internal/pycore_time.h: extern "C" { - #endif + #include "pycore_runtime_structs.h" // _PyTimeFraction -#ifdef __clang__ +#ifdef MS_WINDOWSBraindump:
--without-remote-debugat build time. I decided to leave it in and just skip all the tests that fail. It's new and just a debugging tool, so I don't think that is a blocker.For future reference, remote debugging fails with:
RuntimeError: Failed to find the PyRuntime section in process 8428 on Windows platformRuntimeError: Failed to get Python runtime address