]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-148690: Build Windows freethreaded binaries into separate directory and include...
authorSteve Dower <steve.dower@python.org>
Mon, 4 May 2026 16:45:08 +0000 (17:45 +0100)
committerGitHub <noreply@github.com>
Mon, 4 May 2026 16:45:08 +0000 (17:45 +0100)
Co-authored-by: Petr Viktorin <encukou@gmail.com>
32 files changed:
Include/pyabi.h
Lib/test/test_cext/__init__.py
Lib/test/test_cext/setup.py
Lib/test/test_cppext/__init__.py
Lib/test/test_cppext/setup.py
Lib/venv/__init__.py
Misc/NEWS.d/next/Build/2026-05-01-12-01-54.gh-issue-148690.oTtYk-.rst [new file with mode: 0644]
Misc/NEWS.d/next/Windows/2026-05-01-12-03-39.gh-issue-148690.TMV8dU.rst [new file with mode: 0644]
PC/layout/main.py
PC/pyconfig.h
PCbuild/_remote_debugging.vcxproj
PCbuild/_testcapi.vcxproj
PCbuild/_testlimitedcapi.vcxproj
PCbuild/pcbuild.proj
PCbuild/pcbuild.sln
PCbuild/pyproject.props
PCbuild/python.props
PCbuild/python3dll.vcxproj
PCbuild/python3tdll.vcxproj [new file with mode: 0644]
PCbuild/python3tdll.vcxproj.filters [new file with mode: 0644]
PCbuild/pythoncore.vcxproj
PCbuild/readme.txt
PCbuild/rt.bat
PCbuild/xxlimited.vcxproj
PCbuild/xxlimited_35.vcxproj
PCbuild/zlib-ng.vcxproj
Python/dynload_win.c
Tools/msi/common.wxs
Tools/msi/core/core_files.wxs
Tools/msi/freethreaded/freethreaded_files.wxs
Tools/msi/msi.props
Tools/peg_generator/pegen/build.py

index 8c4ae281a43faf3d13f39982efa06a915fe7506c..21a6ab0c1ee6ea28665a751e18f3bc806d343146 100644 (file)
@@ -55,6 +55,8 @@
  *
  *  (Don't use Py_TARGET_ABI3T directly. It's currently only used to set these
  *   2 macros, and defined for users' convenience.)
+ *
+ * This logic is currently partially duplicated in PC/pyconfig.h.
  */
 #if defined(Py_LIMITED_API) && defined(Py_GIL_DISABLED) \
         && !defined(Py_TARGET_ABI3T)
index 1958c44e2b64ef7fd7686f99c1903b468a04ce2b..4cc5f843dd388da7114daaa36869b3cdf6ce7f61 100644 (file)
@@ -8,6 +8,8 @@ import os.path
 import shlex
 import shutil
 import subprocess
+import sysconfig
+import sys
 import unittest
 from test import support
 
@@ -62,6 +64,9 @@ class BaseTests:
                 env['CPYTHON_TEST_LIMITED'] = '1'
             if abi3t:
                 env['CPYTHON_TEST_ABI3T'] = '1'
+            if support.MS_WINDOWS and sysconfig.is_python_build():
+                env['CPYTHON_EXTRA_INCDIRS'] = os.path.split(sysconfig.get_config_h_filename())[0]
+                env['CPYTHON_EXTRA_LIBDIRS'] = os.path.split(sys.executable)[0]
             env['CPYTHON_TEST_EXT_NAME'] = extension_name
             env['TEST_INTERNAL_C_API'] = str(int(self.TEST_INTERNAL_C_API))
             if support.verbose:
index 25fe50df603883fbea9228198994d3bc3de6a8b6..1eca44bdf823dc2243bd163f263a5e3853199123 100644 (file)
@@ -1,7 +1,6 @@
 # gh-91321: Build a basic C test extension to check that the Python C API is
 # compatible with C and does not emit C compiler warnings.
 import os
-import platform
 import shlex
 import sys
 import sysconfig
@@ -66,6 +65,8 @@ def main():
     limited = bool(os.environ.get("CPYTHON_TEST_LIMITED", ""))
     abi3t = bool(os.environ.get("CPYTHON_TEST_ABI3T", ""))
     internal = bool(int(os.environ.get("TEST_INTERNAL_C_API", "0")))
+    incdirs = os.environ.get("CPYTHON_EXTRA_INCDIRS", "")
+    libdirs = os.environ.get("CPYTHON_EXTRA_LIBDIRS", "")
 
     sources = [SOURCE]
 
@@ -106,19 +107,16 @@ def main():
     if internal:
         cflags.append('-DTEST_INTERNAL_C_API=1')
 
-    # On Windows, add PCbuild\amd64\ to include and library directories
+    # Add additional include and library directories, typically for in-tree
+    # testing where not all directories are inferred
     include_dirs = []
     library_dirs = []
-    if support.MS_WINDOWS:
-        srcdir = sysconfig.get_config_var('srcdir')
-        machine = platform.uname().machine
-        pcbuild = os.path.join(srcdir, 'PCbuild', machine)
-        if os.path.exists(pcbuild):
-            # pyconfig.h is generated in PCbuild\amd64\
-            include_dirs.append(pcbuild)
-            # python313.lib is generated in PCbuild\amd64\
-            library_dirs.append(pcbuild)
-            print(f"Add PCbuild directory: {pcbuild}")
+    if incdirs:
+        print("Add incdirs:", incdirs)
+        include_dirs.extend(incdirs.split(os.pathsep))
+    if libdirs:
+        print("Add libdirs:", libdirs)
+        library_dirs.extend(libdirs.split(os.pathsep))
 
     # Display information to help debugging
     for env_name in ('CC', 'CFLAGS', 'CPPFLAGS'):
index 5b4c97c181bb6aeb31d200540b4519253040e71a..967feee6693c037d7e5b4222bdc661a37c2d5802 100644 (file)
@@ -6,6 +6,7 @@ import shlex
 import shutil
 import subprocess
 import sys
+import sysconfig
 import unittest
 from test import support
 
@@ -50,6 +51,9 @@ class BaseTests:
                 env['CPYTHON_TEST_CPP_STD'] = std
             if limited:
                 env['CPYTHON_TEST_LIMITED'] = '1'
+            if support.MS_WINDOWS and sysconfig.is_python_build():
+                env['CPYTHON_EXTRA_INCDIRS'] = os.path.split(sysconfig.get_config_h_filename())[0]
+                env['CPYTHON_EXTRA_LIBDIRS'] = os.path.split(sys.executable)[0]
             env['CPYTHON_TEST_EXT_NAME'] = extension_name
             env['TEST_INTERNAL_C_API'] = str(int(self.TEST_INTERNAL_C_API))
             if extra_cflags:
index 14aeafefcaa8f72c2bacf46a88c8ed05d2783af3..5d004ca6e3ad78893ae320ec1c3ece30b994f8c5 100644 (file)
@@ -1,7 +1,6 @@
 # gh-91321: Build a basic C++ test extension to check that the Python C API is
 # compatible with C++ and does not emit C++ compiler warnings.
 import os
-import platform
 import shlex
 import sys
 import sysconfig
@@ -48,6 +47,8 @@ def main():
     module_name = os.environ["CPYTHON_TEST_EXT_NAME"]
     limited = bool(os.environ.get("CPYTHON_TEST_LIMITED", ""))
     internal = bool(int(os.environ.get("TEST_INTERNAL_C_API", "0")))
+    incdirs = os.environ.get("CPYTHON_EXTRA_INCDIRS", "")
+    libdirs = os.environ.get("CPYTHON_EXTRA_LIBDIRS", "")
 
     cppflags = list(CPPFLAGS)
     cppflags.append(f'-DMODULE_NAME={module_name}')
@@ -90,19 +91,16 @@ def main():
     if extra_cflags:
         cppflags.extend(shlex.split(extra_cflags))
 
-    # On Windows, add PCbuild\amd64\ to include and library directories
+    # Add additional include and library directories, typically for in-tree
+    # testing where not all directories are inferred
     include_dirs = []
     library_dirs = []
-    if support.MS_WINDOWS:
-        srcdir = sysconfig.get_config_var('srcdir')
-        machine = platform.uname().machine
-        pcbuild = os.path.join(srcdir, 'PCbuild', machine)
-        if os.path.exists(pcbuild):
-            # pyconfig.h is generated in PCbuild\amd64\
-            include_dirs.append(pcbuild)
-            # python313.lib is generated in PCbuild\amd64\
-            library_dirs.append(pcbuild)
-            print(f"Add PCbuild directory: {pcbuild}")
+    if incdirs:
+        print("Add incdirs:", incdirs)
+        include_dirs.extend(incdirs.split(os.pathsep))
+    if libdirs:
+        print("Add libdirs:", libdirs)
+        library_dirs.extend(libdirs.split(os.pathsep))
 
     # Display information to help debugging
     for env_name in ('CC', 'CXX', 'CFLAGS', 'CPPFLAGS', 'CXXFLAGS'):
index 21f82125f5a7c404639fabf642e672e63fe465b8..002f4ebc988a3b5a9c5ec61fbb81578eeabe0381 100644 (file)
@@ -358,6 +358,9 @@ class EnvBuilder:
                 exe_t = f'3.{sys.version_info[1]}t'
                 python_exe = os.path.join(dirname, f'python{exe_t}{exe_d}.exe')
                 pythonw_exe = os.path.join(dirname, f'pythonw{exe_t}{exe_d}.exe')
+                if not os.path.isfile(python_exe):
+                    python_exe = os.path.join(dirname, f'python{exe_d}.exe')
+                    pythonw_exe = os.path.join(dirname, f'pythonw{exe_d}.exe')
                 link_sources = {
                     'python.exe': python_exe,
                     f'python{exe_d}.exe': python_exe,
diff --git a/Misc/NEWS.d/next/Build/2026-05-01-12-01-54.gh-issue-148690.oTtYk-.rst b/Misc/NEWS.d/next/Build/2026-05-01-12-01-54.gh-issue-148690.oTtYk-.rst
new file mode 100644 (file)
index 0000000..6845bad
--- /dev/null
@@ -0,0 +1,4 @@
+Windows free-threaded builds now output to a different default path with
+default filenames, for example, ``PCbuild/amd64t/python.exe`` rather than
+``PCbuild/amd64/python3.15t.exe``. The ``PC/layout`` script has been updated
+to ensure compatibility of generated layouts.
diff --git a/Misc/NEWS.d/next/Windows/2026-05-01-12-03-39.gh-issue-148690.TMV8dU.rst b/Misc/NEWS.d/next/Windows/2026-05-01-12-03-39.gh-issue-148690.TMV8dU.rst
new file mode 100644 (file)
index 0000000..1fa30f1
--- /dev/null
@@ -0,0 +1,3 @@
+Non-freethreaded builds on Windows now support extensions linked to
+``python3t.dll``, and will include a copy of that library in normal installs
+that references the non-freethreaded runtime.
index 8543e7c56e1c419ae0250f678f93da31e04140d4..3566b8bd873874c13cff985e06e3c40ecb5d52fb 100644 (file)
@@ -127,7 +127,10 @@ def get_tcltk_lib(ns):
 def get_layout(ns):
     def in_build(f, dest="", new_name=None, no_lib=False):
         n, _, x = f.rpartition(".")
-        n = new_name or n
+        if new_name and new_name.endswith(f".{x}"):
+            n = new_name.rpartition(".")[0]
+        else:
+            n = new_name or n
         src = ns.build / f
         if ns.debug and src not in REQUIRED_DLLS:
             if not "_d." in src.name:
@@ -161,11 +164,12 @@ def get_layout(ns):
         source = "python_uwp.exe"
         sourcew = "pythonw_uwp.exe"
     elif ns.include_freethreaded:
-        source = "python{}t.exe".format(VER_DOT)
-        sourcew = "pythonw{}t.exe".format(VER_DOT)
         if not ns.include_alias:
             alias = []
             aliasw = []
+        if (VER_MAJOR, VER_MINOR, VER_MICRO, VER_FIELD4) < (3, 15, 0, 0xB0):
+            source = "python{}t.exe".format(VER_DOT)
+            sourcew = "pythonw{}t.exe".format(VER_DOT)
         alias.extend([
             "python{}t".format(VER_DOT),
             "python{}t".format(VER_MAJOR) if ns.include_alias3 else None,
@@ -196,6 +200,8 @@ def get_layout(ns):
             yield from in_build(FREETHREADED_PYTHON_STABLE_DLL_NAME)
         else:
             yield from in_build(PYTHON_STABLE_DLL_NAME)
+            if (VER_MAJOR, VER_MINOR, VER_MICRO, VER_FIELD4) >= (3, 15, 0, 0xB0):
+                yield from in_build(FREETHREADED_PYTHON_STABLE_DLL_NAME)
 
     found_any = False
     for dest, src in rglob(ns.build, "vcruntime*.dll"):
index a126fca6f5aafb1d795668bdcacfcdec8826a7d1..72a475777b7ad0c14ae9a9abab60550f0adae563 100644 (file)
@@ -331,7 +331,7 @@ Py_NO_ENABLE_SHARED to find out.  Also support MS_NO_COREDLL for b/w compat */
 #                       if defined(Py_GIL_DISABLED)
 #                       if defined(Py_DEBUG)
 #                               pragma comment(lib,"python315t_d.lib")
-#                       elif defined(Py_LIMITED_API)
+#                       elif defined(Py_LIMITED_API) || defined(Py_TARGET_ABI3T)
 #                               pragma comment(lib,"python3t.lib")
 #                       else
 #                               pragma comment(lib,"python315t.lib")
@@ -339,6 +339,8 @@ Py_NO_ENABLE_SHARED to find out.  Also support MS_NO_COREDLL for b/w compat */
 #                       else /* Py_GIL_DISABLED */
 #                       if defined(Py_DEBUG)
 #                               pragma comment(lib,"python315_d.lib")
+#                       elif defined(Py_TARGET_ABI3T)
+#                               pragma comment(lib,"python3t.lib")
 #                       elif defined(Py_LIMITED_API)
 #                               pragma comment(lib,"python3.lib")
 #                       else
index 3a9b4033a697ad30e88e3f3c85c1e9d366d0bd1a..41aadbd13d0995d82ab34f8fe2a214158cd84814 100644 (file)
       <Project>{885d4898-d08d-4091-9c40-c700cfe3fc5a}</Project>
       <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
     </ProjectReference>
+    <ProjectReference Include="python3tdll.vcxproj">
+      <Project>{947BB5F5-6025-4A4F-8182-1B175469F8D2}</Project>
+      <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+    </ProjectReference>
   </ItemGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
   <ImportGroup Label="ExtensionTargets">
index 68707a54ff6b874f9b3fa19c54b54b1d6ae6f828..62312acf248b918a1090369445951777903f6ea0 100644 (file)
       <Project>{885d4898-d08d-4091-9c40-c700cfe3fc5a}</Project>
       <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
     </ProjectReference>
+    <ProjectReference Include="python3tdll.vcxproj">
+      <Project>{947BB5F5-6025-4A4F-8182-1B175469F8D2}</Project>
+      <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+    </ProjectReference>
   </ItemGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
   <ImportGroup Label="ExtensionTargets">
index 935467dfcb32834e3bc40f2810d0d002cf19e3dd..3d70517fbe31e8c73110f2263d21ead0e427c8dd 100644 (file)
       <Project>{885d4898-d08d-4091-9c40-c700cfe3fc5a}</Project>
       <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
     </ProjectReference>
+    <ProjectReference Include="python3tdll.vcxproj">
+      <Project>{947BB5F5-6025-4A4F-8182-1B175469F8D2}</Project>
+      <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+    </ProjectReference>
   </ItemGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
   <ImportGroup Label="ExtensionTargets">
index 7a5327bf016cea9d8fe59fde433907c508dcd70a..bb7d8042176d8f173161744097147157ed852973 100644 (file)
@@ -61,6 +61,8 @@
     </Projects>
     <!-- python3.dll -->
     <Projects Include="python3dll.vcxproj" />
+    <!-- python3t.dll -->
+    <Projects Include="python3tdll.vcxproj" />
     <!-- py[w].exe -->
     <Projects Include="pylauncher.vcxproj;pywlauncher.vcxproj" />
     <!-- pyshellext.dll -->
index 7296ea75301157d80fd8b397a81c062558307da6..09a989d38648df48f21ecf3893ddda76a3f7e4a1 100644 (file)
@@ -33,6 +33,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "python", "python.vcxproj",
                {78D80A15-BD8C-44E2-B49E-1F05B0A0A687} = {78D80A15-BD8C-44E2-B49E-1F05B0A0A687}
                {86937F53-C189-40EF-8CE8-8759D8E7D480} = {86937F53-C189-40EF-8CE8-8759D8E7D480}
                {885D4898-D08D-4091-9C40-C700CFE3FC5A} = {885D4898-D08D-4091-9C40-C700CFE3FC5A}
+               {947BB5F5-6025-4A4F-8182-1B175469F8D2} = {947BB5F5-6025-4A4F-8182-1B175469F8D2}
                {900342D7-516A-4469-B1AD-59A66E49A25F} = {900342D7-516A-4469-B1AD-59A66E49A25F}
                {9E48B300-37D1-11DD-8C41-005056C00008} = {9E48B300-37D1-11DD-8C41-005056C00008}
                {9EC7190A-249F-4180-A900-548FDCF3055F} = {9EC7190A-249F-4180-A900-548FDCF3055F}
@@ -104,6 +105,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_multiprocessing", "_multip
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "python3dll", "python3dll.vcxproj", "{885D4898-D08D-4091-9C40-C700CFE3FC5A}"
 EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "python3tdll", "python3tdll.vcxproj", "{947BB5F5-6025-4A4F-8182-1B175469F8D2}"
+EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xxlimited", "xxlimited.vcxproj", "{F749B822-B489-4CA5-A3AD-CE078F5F338A}"
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_testbuffer", "_testbuffer.vcxproj", "{A2697BD3-28C1-4AEC-9106-8B748639FD16}"
@@ -168,6 +171,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_remote_debugging", "_remot
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_zstd", "_zstd.vcxproj", "{07029B86-F3E9-443E-86FB-78AA6D47FED1}"
 EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xxlimited_35", "xxlimited_35.vcxproj", "{FB868EA7-F93A-4D9B-BE78-CA4E9BA14FFF}"
+EndProject
 Global
        GlobalSection(SolutionConfigurationPlatforms) = preSolution
                Debug|ARM = Debug|ARM
@@ -984,6 +989,38 @@ Global
                {885D4898-D08D-4091-9C40-C700CFE3FC5A}.Release|Win32.Build.0 = Release|Win32
                {885D4898-D08D-4091-9C40-C700CFE3FC5A}.Release|x64.ActiveCfg = Release|x64
                {885D4898-D08D-4091-9C40-C700CFE3FC5A}.Release|x64.Build.0 = Release|x64
+               {947BB5F5-6025-4A4F-8182-1B175469F8D2}.Debug|ARM.ActiveCfg = Debug|ARM
+               {947BB5F5-6025-4A4F-8182-1B175469F8D2}.Debug|ARM.Build.0 = Debug|ARM
+               {947BB5F5-6025-4A4F-8182-1B175469F8D2}.Debug|ARM64.ActiveCfg = Debug|ARM64
+               {947BB5F5-6025-4A4F-8182-1B175469F8D2}.Debug|ARM64.Build.0 = Debug|ARM64
+               {947BB5F5-6025-4A4F-8182-1B175469F8D2}.Debug|Win32.ActiveCfg = Debug|Win32
+               {947BB5F5-6025-4A4F-8182-1B175469F8D2}.Debug|Win32.Build.0 = Debug|Win32
+               {947BB5F5-6025-4A4F-8182-1B175469F8D2}.Debug|x64.ActiveCfg = Debug|x64
+               {947BB5F5-6025-4A4F-8182-1B175469F8D2}.Debug|x64.Build.0 = Debug|x64
+               {947BB5F5-6025-4A4F-8182-1B175469F8D2}.PGInstrument|ARM.ActiveCfg = PGInstrument|ARM
+               {947BB5F5-6025-4A4F-8182-1B175469F8D2}.PGInstrument|ARM.Build.0 = PGInstrument|ARM
+               {947BB5F5-6025-4A4F-8182-1B175469F8D2}.PGInstrument|ARM64.ActiveCfg = PGInstrument|ARM64
+               {947BB5F5-6025-4A4F-8182-1B175469F8D2}.PGInstrument|ARM64.Build.0 = PGInstrument|ARM64
+               {947BB5F5-6025-4A4F-8182-1B175469F8D2}.PGInstrument|Win32.ActiveCfg = Debug|Win32
+               {947BB5F5-6025-4A4F-8182-1B175469F8D2}.PGInstrument|Win32.Build.0 = Debug|Win32
+               {947BB5F5-6025-4A4F-8182-1B175469F8D2}.PGInstrument|x64.ActiveCfg = Debug|x64
+               {947BB5F5-6025-4A4F-8182-1B175469F8D2}.PGInstrument|x64.Build.0 = Debug|x64
+               {947BB5F5-6025-4A4F-8182-1B175469F8D2}.PGUpdate|ARM.ActiveCfg = PGUpdate|ARM
+               {947BB5F5-6025-4A4F-8182-1B175469F8D2}.PGUpdate|ARM.Build.0 = PGUpdate|ARM
+               {947BB5F5-6025-4A4F-8182-1B175469F8D2}.PGUpdate|ARM64.ActiveCfg = PGUpdate|ARM64
+               {947BB5F5-6025-4A4F-8182-1B175469F8D2}.PGUpdate|ARM64.Build.0 = PGUpdate|ARM64
+               {947BB5F5-6025-4A4F-8182-1B175469F8D2}.PGUpdate|Win32.ActiveCfg = Debug|Win32
+               {947BB5F5-6025-4A4F-8182-1B175469F8D2}.PGUpdate|Win32.Build.0 = Debug|Win32
+               {947BB5F5-6025-4A4F-8182-1B175469F8D2}.PGUpdate|x64.ActiveCfg = Debug|x64
+               {947BB5F5-6025-4A4F-8182-1B175469F8D2}.PGUpdate|x64.Build.0 = Debug|x64
+               {947BB5F5-6025-4A4F-8182-1B175469F8D2}.Release|ARM.ActiveCfg = Release|ARM
+               {947BB5F5-6025-4A4F-8182-1B175469F8D2}.Release|ARM.Build.0 = Release|ARM
+               {947BB5F5-6025-4A4F-8182-1B175469F8D2}.Release|ARM64.ActiveCfg = Release|ARM64
+               {947BB5F5-6025-4A4F-8182-1B175469F8D2}.Release|ARM64.Build.0 = Release|ARM64
+               {947BB5F5-6025-4A4F-8182-1B175469F8D2}.Release|Win32.ActiveCfg = Release|Win32
+               {947BB5F5-6025-4A4F-8182-1B175469F8D2}.Release|Win32.Build.0 = Release|Win32
+               {947BB5F5-6025-4A4F-8182-1B175469F8D2}.Release|x64.ActiveCfg = Release|x64
+               {947BB5F5-6025-4A4F-8182-1B175469F8D2}.Release|x64.Build.0 = Release|x64
                {F749B822-B489-4CA5-A3AD-CE078F5F338A}.Debug|ARM.ActiveCfg = Debug|ARM
                {F749B822-B489-4CA5-A3AD-CE078F5F338A}.Debug|ARM64.ActiveCfg = Debug|ARM64
                {F749B822-B489-4CA5-A3AD-CE078F5F338A}.Debug|Win32.ActiveCfg = Release|Win32
@@ -1785,6 +1822,38 @@ Global
                {07029B86-F3E9-443E-86FB-78AA6D47FED1}.Release|Win32.Build.0 = Release|Win32
                {07029B86-F3E9-443E-86FB-78AA6D47FED1}.Release|x64.ActiveCfg = Release|x64
                {07029B86-F3E9-443E-86FB-78AA6D47FED1}.Release|x64.Build.0 = Release|x64
+               {FB868EA7-F93A-4D9B-BE78-CA4E9BA14FFF}.Debug|ARM.ActiveCfg = Debug|ARM
+               {FB868EA7-F93A-4D9B-BE78-CA4E9BA14FFF}.Debug|ARM.Build.0 = Debug|ARM
+               {FB868EA7-F93A-4D9B-BE78-CA4E9BA14FFF}.Debug|ARM64.ActiveCfg = Debug|ARM64
+               {FB868EA7-F93A-4D9B-BE78-CA4E9BA14FFF}.Debug|ARM64.Build.0 = Debug|ARM64
+               {FB868EA7-F93A-4D9B-BE78-CA4E9BA14FFF}.Debug|Win32.ActiveCfg = Debug|Win32
+               {FB868EA7-F93A-4D9B-BE78-CA4E9BA14FFF}.Debug|Win32.Build.0 = Debug|Win32
+               {FB868EA7-F93A-4D9B-BE78-CA4E9BA14FFF}.Debug|x64.ActiveCfg = Debug|x64
+               {FB868EA7-F93A-4D9B-BE78-CA4E9BA14FFF}.Debug|x64.Build.0 = Debug|x64
+               {FB868EA7-F93A-4D9B-BE78-CA4E9BA14FFF}.PGInstrument|ARM.ActiveCfg = PGInstrument|ARM
+               {FB868EA7-F93A-4D9B-BE78-CA4E9BA14FFF}.PGInstrument|ARM.Build.0 = PGInstrument|ARM
+               {FB868EA7-F93A-4D9B-BE78-CA4E9BA14FFF}.PGInstrument|ARM64.ActiveCfg = PGInstrument|ARM64
+               {FB868EA7-F93A-4D9B-BE78-CA4E9BA14FFF}.PGInstrument|ARM64.Build.0 = PGInstrument|ARM64
+               {FB868EA7-F93A-4D9B-BE78-CA4E9BA14FFF}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32
+               {FB868EA7-F93A-4D9B-BE78-CA4E9BA14FFF}.PGInstrument|Win32.Build.0 = PGInstrument|Win32
+               {FB868EA7-F93A-4D9B-BE78-CA4E9BA14FFF}.PGInstrument|x64.ActiveCfg = PGInstrument|x64
+               {FB868EA7-F93A-4D9B-BE78-CA4E9BA14FFF}.PGInstrument|x64.Build.0 = PGInstrument|x64
+               {FB868EA7-F93A-4D9B-BE78-CA4E9BA14FFF}.PGUpdate|ARM.ActiveCfg = PGUpdate|ARM
+               {FB868EA7-F93A-4D9B-BE78-CA4E9BA14FFF}.PGUpdate|ARM.Build.0 = PGUpdate|ARM
+               {FB868EA7-F93A-4D9B-BE78-CA4E9BA14FFF}.PGUpdate|ARM64.ActiveCfg = PGUpdate|ARM64
+               {FB868EA7-F93A-4D9B-BE78-CA4E9BA14FFF}.PGUpdate|ARM64.Build.0 = PGUpdate|ARM64
+               {FB868EA7-F93A-4D9B-BE78-CA4E9BA14FFF}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32
+               {FB868EA7-F93A-4D9B-BE78-CA4E9BA14FFF}.PGUpdate|Win32.Build.0 = PGUpdate|Win32
+               {FB868EA7-F93A-4D9B-BE78-CA4E9BA14FFF}.PGUpdate|x64.ActiveCfg = PGUpdate|x64
+               {FB868EA7-F93A-4D9B-BE78-CA4E9BA14FFF}.PGUpdate|x64.Build.0 = PGUpdate|x64
+               {FB868EA7-F93A-4D9B-BE78-CA4E9BA14FFF}.Release|ARM.ActiveCfg = Release|ARM
+               {FB868EA7-F93A-4D9B-BE78-CA4E9BA14FFF}.Release|ARM.Build.0 = Release|ARM
+               {FB868EA7-F93A-4D9B-BE78-CA4E9BA14FFF}.Release|ARM64.ActiveCfg = Release|ARM64
+               {FB868EA7-F93A-4D9B-BE78-CA4E9BA14FFF}.Release|ARM64.Build.0 = Release|ARM64
+               {FB868EA7-F93A-4D9B-BE78-CA4E9BA14FFF}.Release|Win32.ActiveCfg = Release|Win32
+               {FB868EA7-F93A-4D9B-BE78-CA4E9BA14FFF}.Release|Win32.Build.0 = Release|Win32
+               {FB868EA7-F93A-4D9B-BE78-CA4E9BA14FFF}.Release|x64.ActiveCfg = Release|x64
+               {FB868EA7-F93A-4D9B-BE78-CA4E9BA14FFF}.Release|x64.Build.0 = Release|x64
        EndGlobalSection
        GlobalSection(SolutionProperties) = preSolution
                HideSolutionNode = FALSE
index f79608e1d58dbc8c8266209c42882ec24081c96b..7435c53e3fdcf9f252c035853678f5484caab5da 100644 (file)
@@ -9,6 +9,7 @@
     <OutDir Condition="!HasTrailingSlash($(OutDir))">$(OutDir)\</OutDir>
     <Py_IntDir Condition="'$(Py_IntDir)' == ''">$(MSBuildThisFileDirectory)obj\</Py_IntDir>
     <IntDir>$(Py_IntDir)\$(MajorVersionNumber)$(MinorVersionNumber)$(ArchName)_$(Configuration)\$(ProjectName)\</IntDir>
+    <IntDir Condition="$(DisableGil) == 'true'">$(Py_IntDir)\$(MajorVersionNumber)$(MinorVersionNumber)$(ArchName)t_$(Configuration)\$(ProjectName)\</IntDir>
     <IntDir>$(IntDir.Replace(`\\`, `\`))</IntDir>
     <GeneratedFrozenModulesDir>$(Py_IntDir)\$(MajorVersionNumber)$(MinorVersionNumber)_frozen\</GeneratedFrozenModulesDir>
     <GeneratedZlibNgDir>$(Py_IntDir)\$(MajorVersionNumber)$(MinorVersionNumber)$(ArchName)_$(Configuration)\zlib-ng\</GeneratedZlibNgDir>
   </PropertyGroup>
 
   <PropertyGroup>
+    <!--
+    We conditionally define preprocessor definitions here, and then include all
+    the properties *unconditionally* in the <PreprocessorDefinition> field below
+    -->
     <_DebugPreprocessorDefinition>NDEBUG;</_DebugPreprocessorDefinition>
     <_DebugPreprocessorDefinition Condition="$(Configuration) == 'Debug'">_DEBUG;</_DebugPreprocessorDefinition>
     <_PyStatsPreprocessorDefinition>PyStats;</_PyStatsPreprocessorDefinition>
     <_PlatformPreprocessorDefinition>_WIN32;</_PlatformPreprocessorDefinition>
     <_PlatformPreprocessorDefinition Condition="$(Platform) == 'x64'">_WIN64;</_PlatformPreprocessorDefinition>
     <_PlatformPreprocessorDefinition Condition="$(Platform) == 'x64' and $(PlatformToolset) != 'ClangCL'">_M_X64;$(_PlatformPreprocessorDefinition)</_PlatformPreprocessorDefinition>
-    <_Py3NamePreprocessorDefinition>PY3_DLLNAME=L"$(Py3DllName)$(PyDebugExt)";</_Py3NamePreprocessorDefinition>
     <_FreeThreadedPreprocessorDefinition Condition="$(DisableGil) == 'true'">Py_GIL_DISABLED=1;</_FreeThreadedPreprocessorDefinition>
     <_PymallocHugepagesPreprocessorDefinition Condition="$(UsePymallocHugepages) == 'true'">PYMALLOC_USE_HUGEPAGES=1;</_PymallocHugepagesPreprocessorDefinition>
+    <_PyUsingPgoPreprocessorDefinition Condition="'$(SupportPGO)' and ($(Configuration) == 'PGInstrument' or $(Configuration) == 'PGUpdate')">_Py_USING_PGO=1;</_PyUsingPgoPreprocessorDefinition>
   </PropertyGroup>
   <ItemDefinitionGroup>
     <ClCompile>
       <AdditionalIncludeDirectories>$(PySourcePath)Include;$(PySourcePath)Include\internal;$(PySourcePath)Include\internal\mimalloc;$(PySourcePath)PC;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions>WIN32;$(_Py3NamePreprocessorDefinition)$(_PlatformPreprocessorDefinition)$(_DebugPreprocessorDefinition)$(_PyStatsPreprocessorDefinition)$(_PydPreprocessorDefinition)$(_FreeThreadedPreprocessorDefinition)$(_PymallocHugepagesPreprocessorDefinition)%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <PreprocessorDefinitions Condition="'$(SupportPGO)' and ($(Configuration) == 'PGInstrument' or $(Configuration) == 'PGUpdate')">_Py_USING_PGO=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions>WIN32;$(_PlatformPreprocessorDefinition)$(_DebugPreprocessorDefinition)$(_PyStatsPreprocessorDefinition)$(_PydPreprocessorDefinition)$(_FreeThreadedPreprocessorDefinition)$(_PymallocHugepagesPreprocessorDefinition)$(_PyUsingPgoPreprocessorDefinition)%(PreprocessorDefinitions)</PreprocessorDefinitions>
 
       <Optimization>MaxSpeed</Optimization>
       <IntrinsicFunctions>true</IntrinsicFunctions>
index f29f3d18de5f9d2092f8892e7ef037b494e625a5..f70321f887ef8c0b23b36fabdc656aed1e2cbc13 100644 (file)
@@ -43,7 +43,7 @@
     <PySourcePath Condition="'$(PySourcePath)' == ''">$([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)\..\))</PySourcePath>
     <PySourcePath Condition="!HasTrailingSlash($(PySourcePath))">$(PySourcePath)\</PySourcePath>
 
-    <!-- Directory where build outputs are put -->
+    <!-- Directories where build outputs are put -->
     <BuildPath32 Condition="'$(Py_OutDir)' == ''">$(PySourcePath)PCbuild\win32\</BuildPath32>
     <BuildPath32 Condition="'$(Py_OutDir)' != ''">$(Py_OutDir)\win32\</BuildPath32>
     <BuildPath64 Condition="'$(Py_OutDir)' == ''">$(PySourcePath)PCbuild\amd64\</BuildPath64>
     <BuildPathArm32 Condition="'$(Py_OutDir)' != ''">$(Py_OutDir)\arm32\</BuildPathArm32>
     <BuildPathArm64 Condition="'$(Py_OutDir)' == ''">$(PySourcePath)PCbuild\arm64\</BuildPathArm64>
     <BuildPathArm64 Condition="'$(Py_OutDir)' != ''">$(Py_OutDir)\arm64\</BuildPathArm64>
+    <BuildPath32t Condition="'$(Py_OutDir)' == ''">$(PySourcePath)PCbuild\win32t\</BuildPath32t>
+    <BuildPath32t Condition="'$(Py_OutDir)' != ''">$(Py_OutDir)\win32t\</BuildPath32t>
+    <BuildPath64t Condition="'$(Py_OutDir)' == ''">$(PySourcePath)PCbuild\amd64t\</BuildPath64t>
+    <BuildPath64t Condition="'$(Py_OutDir)' != ''">$(Py_OutDir)\amd64t\</BuildPath64t>
+    <BuildPathArm32t Condition="'$(Py_OutDir)' == ''">$(PySourcePath)PCbuild\arm32t\</BuildPathArm32t>
+    <BuildPathArm32t Condition="'$(Py_OutDir)' != ''">$(Py_OutDir)\arm32t\</BuildPathArm32t>
+    <BuildPathArm64t Condition="'$(Py_OutDir)' == ''">$(PySourcePath)PCbuild\arm64t\</BuildPathArm64t>
+    <BuildPathArm64t Condition="'$(Py_OutDir)' != ''">$(Py_OutDir)\arm64t\</BuildPathArm64t>
+  </PropertyGroup>
+
+  <PropertyGroup Condition="$(DisableGil) != 'true'">
     <BuildPath Condition="'$(ArchName)' == 'win32'">$(BuildPath32)</BuildPath>
     <BuildPath Condition="'$(ArchName)' == 'amd64'">$(BuildPath64)</BuildPath>
     <BuildPath Condition="'$(ArchName)' == 'arm32'">$(BuildPathArm32)</BuildPath>
     <BuildPath Condition="'$(ArchName)' == 'arm64'">$(BuildPathArm64)</BuildPath>
     <BuildPath Condition="'$(BuildPath)' == ''">$(PySourcePath)PCbuild\$(ArchName)\</BuildPath>
+  </PropertyGroup>
+
+  <PropertyGroup Condition="$(DisableGil) == 'true'">
+    <!-- Directory where build outputs are put -->
+    <BuildPath Condition="'$(ArchName)' == 'win32'">$(BuildPath32t)</BuildPath>
+    <BuildPath Condition="'$(ArchName)' == 'amd64'">$(BuildPath64t)</BuildPath>
+    <BuildPath Condition="'$(ArchName)' == 'arm32'">$(BuildPathArm32t)</BuildPath>
+    <BuildPath Condition="'$(ArchName)' == 'arm64'">$(BuildPathArm64t)</BuildPath>
+    <BuildPath Condition="'$(BuildPath)' == ''">$(PySourcePath)PCbuild\$(ArchName)t\</BuildPath>
+  </PropertyGroup>
+
+  <PropertyGroup>
     <BuildPath Condition="!HasTrailingSlash($(BuildPath))">$(BuildPath)\</BuildPath>
     <BuildPath Condition="$(Configuration) == 'PGInstrument'">$(BuildPath)instrumented\</BuildPath>
 
     <Field3Value Condition="$(UseTestMarker) == 'true'">$([msbuild]::Add($(Field3Value), 9000))</Field3Value>
 
     <!-- Name and full path of the resulting python.exe binary -->
-    <PyExeName Condition="$(DisableGil) == 'true'">python$(MajorVersionNumber).$(MinorVersionNumber)t</PyExeName>
     <PyExeName Condition="$(PyExeName) == ''">python</PyExeName>
     <PythonExe Condition="'$(PythonExe)' == ''">$(BuildPath)$(PyExeName)$(PyDebugExt).exe</PythonExe>
-    <PyWExeName Condition="$(DisableGil) == 'true'">pythonw$(MajorVersionNumber).$(MinorVersionNumber)t</PyWExeName>
     <PyWExeName Condition="$(PyWExeName) == ''">pythonw</PyWExeName>
 
     <!-- The name of the resulting pythonXY.dll (without the extension) -->
     <PyDllName Condition="$(DisableGil) == 'true'">python$(MajorVersionNumber)$(MinorVersionNumber)t$(PyDebugExt)</PyDllName>
     <PyDllName Condition="$(PyDllName) == ''">python$(MajorVersionNumber)$(MinorVersionNumber)$(PyDebugExt)</PyDllName>
+
     <!-- The name of the resulting pythonX.dll (without the extension) -->
-    <Py3DllName Condition="$(DisableGil) == 'true'">python3t</Py3DllName>
     <Py3DllName Condition="$(Py3DllName) == ''">python3</Py3DllName>
+    <Abi3tDllName Condition="$(Abi3tDllName) == ''">python3t</Abi3tDllName>
 
     <!-- The version and platform tag to include in .pyd filenames -->
     <PydTag Condition="$(ArchName) == 'win32'">.cp$(MajorVersionNumber)$(MinorVersionNumber)-win32</PydTag>
index 235ea1cf9d33fb94e7e48a9dc1b67968ae7a9dc1..3d8ac1b23532c1d7f75d5545caae260d6e2e4308 100644 (file)
@@ -75,7 +75,7 @@
   <Import Project="python.props" />
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
   <PropertyGroup Label="Configuration">
-    <TargetName>$(Py3DllName)</TargetName>
+    <TargetName>python3</TargetName>
     <ConfigurationType>DynamicLibrary</ConfigurationType>
   </PropertyGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
diff --git a/PCbuild/python3tdll.vcxproj b/PCbuild/python3tdll.vcxproj
new file mode 100644 (file)
index 0000000..796712c
--- /dev/null
@@ -0,0 +1,110 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|ARM">
+      <Configuration>Debug</Configuration>
+      <Platform>ARM</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|ARM64">
+      <Configuration>Debug</Configuration>
+      <Platform>ARM64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|Win32">
+      <Configuration>Debug</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|x64">
+      <Configuration>Debug</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="PGInstrument|ARM">
+      <Configuration>PGInstrument</Configuration>
+      <Platform>ARM</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="PGInstrument|ARM64">
+      <Configuration>PGInstrument</Configuration>
+      <Platform>ARM64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="PGInstrument|Win32">
+      <Configuration>PGInstrument</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="PGInstrument|x64">
+      <Configuration>PGInstrument</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="PGUpdate|ARM">
+      <Configuration>PGUpdate</Configuration>
+      <Platform>ARM</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="PGUpdate|ARM64">
+      <Configuration>PGUpdate</Configuration>
+      <Platform>ARM64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="PGUpdate|Win32">
+      <Configuration>PGUpdate</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="PGUpdate|x64">
+      <Configuration>PGUpdate</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|ARM">
+      <Configuration>Release</Configuration>
+      <Platform>ARM</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|ARM64">
+      <Configuration>Release</Configuration>
+      <Platform>ARM64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|x64">
+      <Configuration>Release</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+  <PropertyGroup Label="Globals">
+    <ProjectGuid>{947BB5F5-6025-4A4F-8182-1B175469F8D2}</ProjectGuid>
+    <RootNamespace>python3tdll</RootNamespace>
+    <Keyword>Win32Proj</Keyword>
+    <SupportPGO>false</SupportPGO>
+  </PropertyGroup>
+  <Import Project="python.props" />
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+  <PropertyGroup Label="Configuration">
+    <TargetName>python3t</TargetName>
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+  <ImportGroup Label="ExtensionSettings">
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+    <Import Project="pyproject.props" />
+  </ImportGroup>
+  <PropertyGroup Label="UserMacros" />
+  <PropertyGroup>
+    <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
+  </PropertyGroup>
+  <ItemDefinitionGroup>
+    <ClCompile>
+      <PreprocessorDefinitions>PYTHON_DLL_NAME="$(PyDllName)";%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <BufferSecurityCheck>false</BufferSecurityCheck>
+    </ClCompile>
+    <Link>
+      <NoEntryPoint>true</NoEntryPoint>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemGroup>
+    <ClCompile Include="..\PC\python3dll.c" />
+  </ItemGroup>
+  <ItemGroup>
+    <ResourceCompile Include="..\PC\python_nt.rc" />
+  </ItemGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+  <ImportGroup Label="ExtensionTargets">
+  </ImportGroup>
+</Project>
diff --git a/PCbuild/python3tdll.vcxproj.filters b/PCbuild/python3tdll.vcxproj.filters
new file mode 100644 (file)
index 0000000..37510e3
--- /dev/null
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup>
+    <Filter Include="Source Files">
+      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
+      <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
+    </Filter>
+    <Filter Include="Resource Files">
+      <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
+      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions>
+    </Filter>
+  </ItemGroup>
+  <ItemGroup>
+    <ClCompile Include="..\PC\python3dll.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+  </ItemGroup>
+  <ItemGroup>
+    <ResourceCompile Include="..\PC\python_nt.rc">
+      <Filter>Resource Files</Filter>
+    </ResourceCompile>
+  </ItemGroup>
+</Project>
index fae4a90b4536fcbb042bc31fb5074183299b53ec..f820c3dd64f58c050b9fd658f507971df8c593ce 100644 (file)
     <ClCompile Include="..\Python\critical_section.c" />
     <ClCompile Include="..\Python\crossinterp.c" />
     <ClCompile Include="..\Python\dynamic_annotations.c" />
-    <ClCompile Include="..\Python\dynload_win.c" />
+    <ClCompile Include="..\Python\dynload_win.c">
+      <PreprocessorDefinitions Condition="$(DisableGil) != 'true'">PY3_DLLNAME=L"$(Py3DllName)";%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions>ABI3T_DLLNAME=L"$(Abi3tDllName)";%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
     <ClCompile Include="..\Python\errors.c" />
     <ClCompile Include="..\Python\fileutils.c" />
     <ClCompile Include="..\Python\flowgraph.c" />
index b98a956034c53755f1e2289a558219886c9f53c9..c291b7f86325f2fbccca4c2a885497005db20707 100644 (file)
@@ -160,6 +160,10 @@ pyshellext
     pyshellext.dll, the shell extension deployed with the launcher
 python3dll
     python3.dll, the PEP 384 Stable ABI dll
+    (not installed on free-threaded builds)
+python3tdll
+    python3t.dll, the PEP 803 free-threading Stable ABI dll
+    (built from the same source as python3.dll)
 xxlimited
     builds an example module that makes use of the PEP 384 Stable ABI,
     see Modules\xxlimited.c
index f1e0607393405beb4d8c3e1e772d65d3b9c1535e..d5c9a24f292327cb28edccf1aac513a03520088f 100644 (file)
@@ -32,6 +32,7 @@ setlocal
 set pcbuild=%~dp0
 set pyname=python
 set suffix=
+set suffix1=
 set qmode=
 set dashO=
 set regrtestargs=--fast-ci
@@ -41,8 +42,7 @@ set exe=
 if "%~1"=="-O" (set dashO=-O)     & shift & goto CheckOpts
 if "%~1"=="-q" (set qmode=yes)    & shift & goto CheckOpts
 if "%~1"=="-d" (set suffix=_d)    & shift & goto CheckOpts
-rem HACK: Need some way to infer the version number in this script
-if "%~1"=="--disable-gil" (set pyname=python3.15t) & shift & goto CheckOpts
+if "%~1"=="--disable-gil" (set suffix1=t) & shift & goto CheckOpts
 if "%~1"=="-win32" (set prefix=%pcbuild%win32) & shift & goto CheckOpts
 if "%~1"=="-x64" (set prefix=%pcbuild%amd64) & shift & goto CheckOpts
 if "%~1"=="-amd64" (set prefix=%pcbuild%amd64) & shift & goto CheckOpts
@@ -52,7 +52,7 @@ if "%~1"=="-p" (call :SetPlatform %~2) & shift & shift & goto CheckOpts
 if NOT "%~1"=="" (set regrtestargs=%regrtestargs% %~1) & shift & goto CheckOpts
 
 if not defined prefix set prefix=%pcbuild%amd64
-set exe=%prefix%\%pyname%%suffix%.exe
+set exe=%prefix%%suffix1%\%pyname%%suffix%.exe
 set cmd="%exe%" %dashO% -m test %regrtestargs%
 if defined qmode goto Qmode
 
@@ -60,7 +60,7 @@ echo Deleting .pyc files ...
 "%exe%" "%pcbuild%rmpyc.py"
 
 echo Cleaning _pth files ...
-if exist %prefix%\*._pth del %prefix%\*._pth
+if exist %prefix%%suffix1%\*._pth del %prefix%%suffix1%\*._pth
 
 echo on
 %cmd%
index 093e6920c0b76ce5fd6f4c04a1d389d0f7cffe9e..f0c3616600148f1bee3a7df4e1b39cc3d30980ff 100644 (file)
     <ProjectReference Include="python3dll.vcxproj">
       <Project>{885d4898-d08d-4091-9c40-c700cfe3fc5a}</Project>
     </ProjectReference>
+    <ProjectReference Include="python3tdll.vcxproj">
+      <Project>{947BB5F5-6025-4A4F-8182-1B175469F8D2}</Project>
+    </ProjectReference>
   </ItemGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
   <ImportGroup Label="ExtensionTargets">
index 3f4d4463f24af075e790b29917384033a042e3a5..bfaf4e253664d4be80bb140f394c8bb2610df524 100644 (file)
     <ProjectReference Include="python3dll.vcxproj">
       <Project>{885d4898-d08d-4091-9c40-c700cfe3fc5a}</Project>
     </ProjectReference>
+    <ProjectReference Include="python3tdll.vcxproj">
+      <Project>{947BB5F5-6025-4A4F-8182-1B175469F8D2}</Project>
+    </ProjectReference>
   </ItemGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
   <ImportGroup Label="ExtensionTargets">
index de1698ae718473a43da20965c4229bb0d71583e7..ffe8e70f2dbbc7d7dc11b926e44c74f43a51dfb8 100644 (file)
     <PropertyGroup>
       <Text>$([System.IO.File]::ReadAllText('$(zlibNgDir)\zlib.h.in').Replace('@ZLIB_SYMBOL_PREFIX@', ''))</Text>
     </PropertyGroup>
-    <WriteLinesToFile File="$(IntDir)zlib.h" Lines="$(Text)" />
+    <MakeDir Directories="$(GeneratedZlibNgDir)" />
+    <WriteLinesToFile File="$(GeneratedZlibNgDir)zlib.h" Lines="$(Text)" />
   </Target>
   <Target Name="_EnsureZlibNgH" Inputs="$(zlibNgDir)\zlib-ng.h.in" Outputs="$(IntDir)zlib-ng.h">
     <PropertyGroup>
       <Text>$([System.IO.File]::ReadAllText('$(zlibNgDir)\zlib-ng.h.in').Replace('@ZLIB_SYMBOL_PREFIX@', ''))</Text>
     </PropertyGroup>
-    <WriteLinesToFile File="$(IntDir)zlib-ng.h" Lines="$(Text)" />
+    <MakeDir Directories="$(GeneratedZlibNgDir)" />
+    <WriteLinesToFile File="$(GeneratedZlibNgDir)zlib-ng.h" Lines="$(Text)" />
   </Target>
 
   <Target Name="_EnsureZlibNgHeaders" BeforeTargets="PrepareForBuild"
index de9b0a77817a63322e2918697119cb81a6554be5..1c2544e94160ac2c0f56b1625beecc4317cc37fb 100644 (file)
@@ -151,11 +151,16 @@ static char *GetPythonImport (HINSTANCE hModule)
    to this python DLL is loaded, not a python3.dll that might be on the path
    by chance.
    Return whether the DLL was found.
+   On free-threaded builds, PY3_DLLNAME is undefined and this is a no-op.
+   _Py_CheckPython3t will check for python3t.dll in that case.
 */
 extern HMODULE PyWin_DLLhModule;
 static int
 _Py_CheckPython3(void)
 {
+#ifndef PY3_DLLNAME
+    return 1;
+#else
     static int python3_checked = 0;
     static HANDLE hPython3;
     #define MAXPATHLEN 512
@@ -169,10 +174,11 @@ _Py_CheckPython3(void)
        use that DLL */
     if (PyWin_DLLhModule && GetModuleFileNameW(PyWin_DLLhModule, py3path, MAXPATHLEN)) {
         wchar_t *p = wcsrchr(py3path, L'\\');
+
         if (p) {
-            wcscpy(p + 1, PY3_DLLNAME);
+            wcscpy(p + 1, PY3_DLLNAME L".dll");
             hPython3 = LoadLibraryExW(py3path, NULL, LOAD_LIBRARY_SEARCH_DEFAULT_DIRS);
-            if (hPython3 != NULL) {
+            if (hPython3) {
                 return 1;
             }
         }
@@ -180,7 +186,7 @@ _Py_CheckPython3(void)
 
     /* If we can locate python3.dll in our application dir,
        use that DLL */
-    hPython3 = LoadLibraryExW(PY3_DLLNAME, NULL, LOAD_LIBRARY_SEARCH_APPLICATION_DIR);
+    hPython3 = LoadLibraryExW(PY3_DLLNAME L".dll", NULL, LOAD_LIBRARY_SEARCH_APPLICATION_DIR);
     if (hPython3 != NULL) {
         return 1;
     }
@@ -192,13 +198,78 @@ _Py_CheckPython3(void)
     assert(config->prefix);
     if (config->prefix) {
         wcscpy_s(py3path, MAXPATHLEN, config->prefix);
-        if (py3path[0] && _Py_add_relfile(py3path, L"DLLs\\" PY3_DLLNAME, MAXPATHLEN) >= 0) {
+        if (py3path[0] && _Py_add_relfile(py3path, L"DLLs\\" PY3_DLLNAME L".dll", MAXPATHLEN) >= 0) {
             hPython3 = LoadLibraryExW(py3path, NULL, LOAD_LIBRARY_SEARCH_DEFAULT_DIRS);
         }
     }
     return hPython3 != NULL;
     #undef MAXPATHLEN
+#endif /* PY3_DLLNAME */
+}
+
+/* To support extensions that can load with both abi3 and abi3t, we also need to
+ * preload python3t.dll. Due to 3.15 still supporting intermingled layouts, the
+ * check is a bit more complicated on that version as we need to try loading
+ * from a subdirectory first in case the adjacent python3t.dll is meant for
+ * python315t.dll (and we are python315.dll).
+ */
+static int
+_Py_CheckPython3t(void)
+{
+#ifndef ABI3T_DLLNAME
+    return 1;
+#else
+#if defined(PY3_DLLNAME) && PY_MAJOR_VERSION==3 && PY_MINOR_VERSION==15
+    /* GIL-enabled builds of 3.15 might have a python3t.dll adjacent that is for
+       a free-threaded build. So we first check in a subdirectory in that case.
+       If it's not there, we'll look adjacent. */
+    #define ABI3T_COMPAT_DLLNAME L"abi3t-compat\\" ABI3T_DLLNAME L".dll"
+#endif
+    static int python3t_checked = 0;
+    static HANDLE hPython3t;
+    #define MAXPATHLEN 512
+    wchar_t py3path[MAXPATHLEN+1];
+    if (python3t_checked) {
+        return hPython3t != NULL;
+    }
+    python3t_checked = 1;
+
+    /* If there is a python3t.dll [in the abi3t-compat dir] next to the
+       python3y.dll, use that DLL */
+    if (PyWin_DLLhModule && GetModuleFileNameW(PyWin_DLLhModule, py3path, MAXPATHLEN)) {
+        wchar_t *p = wcsrchr(py3path, L'\\');
+
+        if (p) {
+#ifdef ABI3T_COMPAT_DLLNAME
+            wcscpy(p + 1, ABI3T_COMPAT_DLLNAME);
+            hPython3t = LoadLibraryExW(py3path, NULL, LOAD_LIBRARY_SEARCH_DEFAULT_DIRS);
+            if (hPython3t == NULL)
+#endif
+            {
+                wcscpy(p + 1, ABI3T_DLLNAME L".dll");
+                hPython3t = LoadLibraryExW(py3path, NULL, LOAD_LIBRARY_SEARCH_DEFAULT_DIRS);
+            }
+            if (hPython3t) {
+                return 1;
+            }
+        }
+    }
+
+    /* If we can locate python3.dll in our application dir,
+       use that DLL */
+#ifdef ABI3T_COMPAT_DLLNAME
+    hPython3t = LoadLibraryExW(ABI3T_COMPAT_DLLNAME, NULL, LOAD_LIBRARY_SEARCH_APPLICATION_DIR);
+    #undef ABI3T_COMPAT_DLLNAME
+    if (hPython3t == NULL)
+#endif
+    {
+        hPython3t = LoadLibraryExW(ABI3T_DLLNAME L".dll", NULL, LOAD_LIBRARY_SEARCH_APPLICATION_DIR);
+    }
+    return hPython3t != NULL;
+    #undef MAXPATHLEN
+#endif /* ABI3T_DLLNAME */
 }
+
 #endif /* Py_ENABLE_SHARED */
 
 dl_funcptr _PyImport_FindSharedFuncptrWindows(const char *prefix,
@@ -210,6 +281,7 @@ dl_funcptr _PyImport_FindSharedFuncptrWindows(const char *prefix,
 
 #ifdef Py_ENABLE_SHARED
     _Py_CheckPython3();
+    _Py_CheckPython3t();
 #endif /* Py_ENABLE_SHARED */
 
     wchar_t *wpathname = PyUnicode_AsWideCharString(pathname, NULL);
index 54fa749ab17cdd0cd1a11da3fbad208b89c44573..73da474e4181f11fcc3928d73db9fb63b6d5da84 100644 (file)
     </Fragment>
     
     <!-- Top-level directories -->
+    <Fragment>
+        <DirectoryRef Id="InstallDirectory">
+            <Directory Id="abi3t_compat" Name="abi3t-compat" />
+        </DirectoryRef>
+    </Fragment>
+
     <Fragment>
         <DirectoryRef Id="InstallDirectory">
             <Directory Id="DLLs" Name="DLLs">
index 145e1471247aa1ea5fef22bdb22ad7987825bccf..8b21501078ea2e6942a4c83df4c8a59cbd1f9206 100644 (file)
@@ -2,6 +2,9 @@
 <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
     <Fragment>
         <ComponentGroup Id="core_dll">
+            <Component Id="python_abi3tcompat.dll" Directory="abi3t_compat" Guid="*">
+                <File Id="python_abi3tcompat.dll" Name="python$(var.MajorVersionNumber)t.dll" KeyPath="yes" />
+            </Component>
             <Component Id="python_stable.dll" Directory="InstallDirectory" Guid="*">
                 <File Id="python_stable.dll" Name="python$(var.MajorVersionNumber).dll" KeyPath="yes" />
             </Component>
@@ -19,6 +22,9 @@
     </Fragment>
     <Fragment>
         <ComponentGroup Id="core_dll_d">
+            <Component Id="python_abi3tcompat_d.dll" Directory="abi3t_compat" Guid="*">
+                <File Id="python_abi3tcompat_d.dll" Name="python$(var.MajorVersionNumber)t_d.dll" KeyPath="yes" />
+            </Component>
             <Component Id="python_stable_d.dll" Directory="InstallDirectory" Guid="*">
                 <File Id="python_stable_d.dll" Name="python$(var.MajorVersionNumber)_d.dll" KeyPath="yes" />
             </Component>
index 0707e77b5e9ab2e5ac3d096020e07bb203ffe990..fdbcaea38eb31758e48898ff70606d0fce7bcc28 100644 (file)
@@ -29,7 +29,7 @@
         
         <ComponentGroup Id="freethreaded_exe">
             <Component Id="freethreaded_python.exe" Directory="InstallDirectory" Guid="$(var.FreethreadedPythonExeComponentGuid)">
-                <File Name="python$(var.ShortVersion)t.exe" KeyPath="yes" />
+                <File Name="python$(var.ShortVersion)t.exe" Source="!(bindpath.build_t)\python.exe" KeyPath="yes" />
                 
                 <RegistryKey Root="HKMU" Key="[FREETHREADED_REGISTRYKEY]">
                     <RegistryValue Key="InstallPath" Type="string" Value="[InstallDirectory]" KeyPath="no" />
                 </RegistryKey>
             </Component>
             <Component Id="freethreaded_pythonw.exe" Directory="InstallDirectory" Guid="$(var.FreethreadedPythonwExeComponentGuid)">
-                <File Name="pythonw$(var.ShortVersion)t.exe" KeyPath="yes" />
+                <File Name="pythonw$(var.ShortVersion)t.exe" Source="!(bindpath.build_t)\pythonw.exe" KeyPath="yes" />
                 <RegistryKey Root="HKMU" Key="[FREETHREADED_REGISTRYKEY]">
                     <RegistryValue Key="InstallPath" Name="WindowedExecutablePath" Type="string" Value="[#pythonw$(var.ShortVersion)t.exe]" KeyPath="no" />
                 </RegistryKey>
             </Component>
             <Component Id="freethreaded_python_stable.dll" Directory="InstallDirectory" Guid="*">
-                <File Id="freethreaded_python_stable.dll" Name="python$(var.MajorVersionNumber)t.dll" KeyPath="yes" />
+                <File Id="freethreaded_python_stable.dll" Name="python$(var.MajorVersionNumber)t.dll" Source="!(bindpath.build_t)\python$(var.MajorVersionNumber)t.dll" KeyPath="yes" />
             </Component>
             <Component Id="freethreaded_python.dll" Directory="InstallDirectory" Guid="*">
-                <File Id="freethreaded_python.dll" Name="python$(var.MajorVersionNumber)$(var.MinorVersionNumber)t.dll" KeyPath="yes" />
+                <File Id="freethreaded_python.dll" Name="python$(var.MajorVersionNumber)$(var.MinorVersionNumber)t.dll" Source="!(bindpath.build_t)\python$(var.MajorVersionNumber)$(var.MinorVersionNumber)t.dll" KeyPath="yes" />
             </Component>
             <Component Id="freethreaded_python_stable.lib" Directory="libs" Guid="*">
-                <File Id="freethreaded_python_stable.lib" Name="python$(var.MajorVersionNumber)t.lib" KeyPath="yes" />
+                <File Id="freethreaded_python_stable.lib" Name="python$(var.MajorVersionNumber)t.lib" Source="!(bindpath.build_t)\python$(var.MajorVersionNumber)t.lib" KeyPath="yes" />
             </Component>
             <Component Id="freethreaded_python.lib" Directory="libs" Guid="*">
-                <File Id="freethreaded_python.lib" Name="python$(var.MajorVersionNumber)$(var.MinorVersionNumber)t.lib" KeyPath="yes" />
+                <File Id="freethreaded_python.lib" Name="python$(var.MajorVersionNumber)$(var.MinorVersionNumber)t.lib" Source="!(bindpath.build_t)\python$(var.MajorVersionNumber)$(var.MinorVersionNumber)t.lib" KeyPath="yes" />
             </Component>
         </ComponentGroup>
     </Fragment>
     <Fragment>
         <ComponentGroup Id="freethreaded_symbols">
             <Component Id="freethreaded_python_dll.pdb" Directory="InstallDirectory" Guid="*">
-                <File Name="python$(var.MajorVersionNumber)$(var.MinorVersionNumber)t.pdb" KeyPath="yes" />
+                <File Name="python$(var.MajorVersionNumber)$(var.MinorVersionNumber)t.pdb" Source="!(bindpath.build_t)\python$(var.MajorVersionNumber)$(var.MinorVersionNumber)t.pdb" KeyPath="yes" />
             </Component>
+            <!--
+            Renaming the PDB like this will break automatic connection by debuggers,
+            but short of making people stop using this installer there's no real option.
+            -->
             <Component Id="freethreaded_python.pdb" Directory="InstallDirectory" Guid="*">
-                <File Name="python$(var.ShortVersion)t.pdb" />
+                <File Name="python$(var.ShortVersion)t.pdb" Source="!(bindpath.build_t)\python.pdb" />
             </Component>
             <Component Id="freethreaded_pythonw.pdb" Directory="InstallDirectory" Guid="*">
-                <File Name="pythonw$(var.ShortVersion)t.pdb" />
+                <File Name="pythonw$(var.ShortVersion)t.pdb" Source="!(bindpath.build_t)\pythonw.pdb" />
             </Component>
         </ComponentGroup>
     </Fragment>
     <Fragment>
         <ComponentGroup Id="freethreaded_dll_d">
             <Component Id="freethreaded_python_stable_d.dll" Directory="InstallDirectory" Guid="*">
-                <File Id="freethreaded_python_stable_d.dll" Name="python$(var.MajorVersionNumber)t_d.dll" KeyPath="yes" />
+                <File Id="freethreaded_python_stable_d.dll" Name="python$(var.MajorVersionNumber)t_d.dll" Source="!(bindpath.build_t)\python$(var.MajorVersionNumber)t_d.dll" KeyPath="yes" />
             </Component>
             <Component Id="freethreaded_python_d.dll" Directory="InstallDirectory" Guid="*">
-                <File Id="freethreaded_python_d.dll" Name="python$(var.MajorVersionNumber)$(var.MinorVersionNumber)t_d.dll" KeyPath="yes" />
-                <File Id="freethreaded_python_d.pdb" Name="python$(var.MajorVersionNumber)$(var.MinorVersionNumber)t_d.pdb" KeyPath="no" />
+                <File Id="freethreaded_python_d.dll" Name="python$(var.MajorVersionNumber)$(var.MinorVersionNumber)t_d.dll" Source="!(bindpath.build_t)\python$(var.MajorVersionNumber)$(var.MinorVersionNumber)t_d.dll" KeyPath="yes" />
+                <File Id="freethreaded_python_d.pdb" Name="python$(var.MajorVersionNumber)$(var.MinorVersionNumber)t_d.pdb" Source="!(bindpath.build_t)\python$(var.MajorVersionNumber)$(var.MinorVersionNumber)t_d.pdb" KeyPath="no" />
             </Component>
             <Component Id="freethreaded_python_stable_d.lib" Directory="libs" Guid="*">
-                <File Id="freethreaded_python_stable_d.lib" Name="python$(var.MajorVersionNumber)t_d.lib" KeyPath="yes" />
+                <File Id="freethreaded_python_stable_d.lib" Name="python$(var.MajorVersionNumber)t_d.lib" Source="!(bindpath.build_t)\python$(var.MajorVersionNumber)t_d.lib" KeyPath="yes" />
             </Component>
             <Component Id="freethreaded_python_d.lib" Directory="libs" Guid="*">
-                <File Id="freethreaded_python_d.lib" Name="python$(var.MajorVersionNumber)$(var.MinorVersionNumber)t_d.lib" KeyPath="yes" />
+                <File Id="freethreaded_python_d.lib" Name="python$(var.MajorVersionNumber)$(var.MinorVersionNumber)t_d.lib" Source="!(bindpath.build_t)\python$(var.MajorVersionNumber)$(var.MinorVersionNumber)t_d.lib" KeyPath="yes" />
             </Component>
         </ComponentGroup>
     </Fragment>
     <Fragment>
         <ComponentGroup Id="freethreaded_exe_d">
             <Component Id="freethreaded_python_d.exe" Directory="InstallDirectory" Guid="*">
-                <File Name="python$(var.ShortVersion)t_d.exe" />
+                <File Name="python$(var.ShortVersion)t_d.exe" Source="!(bindpath.build_t)python_d.exe" />
             </Component>
             <Component Id="freethreaded_python_d.pdb" Directory="InstallDirectory" Guid="*">
-                <File Name="python$(var.ShortVersion)t_d.pdb" />
+                <File Name="python$(var.ShortVersion)t_d.pdb" Source="!(bindpath.build_t)python_d.pdb" />
             </Component>
             <Component Id="freethreaded_pythonw_d.exe" Directory="InstallDirectory" Guid="*">
-                <File Name="pythonw$(var.ShortVersion)t_d.exe" />
+                <File Name="pythonw$(var.ShortVersion)t_d.exe" Source="!(bindpath.build_t)pythonw_d.exe" />
             </Component>
             <Component Id="freethreaded_pythonw_d.pdb" Directory="InstallDirectory" Guid="*">
-                <File Name="pythonw$(var.ShortVersion)t_d.pdb" />
+                <File Name="pythonw$(var.ShortVersion)t_d.pdb" Source="!(bindpath.build_t)pythonw_d.pdb" />
             </Component>
         </ComponentGroup>
     </Fragment>
             <?foreach ext in $(var.exts)?>
         
             <Component Id="freethreaded_$(var.ext).pyd" Directory="DLLs" Guid="*">
-                <File Name="$(var.ext)$(var.FreethreadedPydTag).pyd" KeyPath="yes" />
+                <File Name="$(var.ext)$(var.FreethreadedPydTag).pyd" Source="!(bindpath.build_t)\$(var.ext)$(var.FreethreadedPydTag).pyd" KeyPath="yes" />
             </Component>
             
             <?endforeach ?>
             
             <Component Id="venvlaunchert.exe" Directory="Lib_venv_scripts_nt__freethreaded" Guid="*">
-                <File Name="venvlaunchert.exe" KeyPath="yes" />
+                <File Name="venvlaunchert.exe" Source="!(bindpath.build_t)\venvlaunchert.exe" KeyPath="yes" />
             </Component>
             <Component Id="venvwlaunchert.exe" Directory="Lib_venv_scripts_nt__freethreaded" Guid="*">
-                <File Name="venvwlaunchert.exe" KeyPath="yes" />
+                <File Name="venvwlaunchert.exe" Source="!(bindpath.build_t)\venvwlaunchert.exe" KeyPath="yes" />
             </Component>
         </ComponentGroup>
     </Fragment>
             <?foreach ext in $(var.exts)?>
             
             <Component Id="freethreaded_$(var.ext).pdb" Directory="DLLs" Guid="*">
-                <File Name="$(var.ext)$(var.FreethreadedPydTag).pdb" />
+                <File Name="$(var.ext)$(var.FreethreadedPydTag).pdb" Source="!(bindpath.build_t)\$(var.ext)$(var.FreethreadedPydTag).pdb" />
             </Component>
             
             <?endforeach ?>
             
             <Component Id="venvlaunchert.pdb" Directory="Lib_venv_scripts_nt__freethreaded" Guid="*">
-                <File Name="venvlaunchert.pdb" KeyPath="yes" />
+                <File Name="venvlaunchert.pdb" Source="!(bindpath.build_t)\venvlaunchert.pdb" KeyPath="yes" />
             </Component>
             <Component Id="venvwlaunchert.pdb" Directory="Lib_venv_scripts_nt__freethreaded" Guid="*">
-                <File Name="venvwlaunchert.pdb" KeyPath="yes" />
+                <File Name="venvwlaunchert.pdb" Source="!(bindpath.build_t)\venvwlaunchert.pdb" KeyPath="yes" />
             </Component>
         </ComponentGroup>
     </Fragment>
             <?foreach ext in $(var.exts)?>
             
             <Component Id="freethreaded_$(var.ext)_d.pyd" Directory="DLLs" Guid="*">
-                <File Name="$(var.ext)_d$(var.FreethreadedPydTag).pyd" />
+                <File Name="$(var.ext)_d$(var.FreethreadedPydTag).pyd" Source="!(bindpath.build_t)\$(var.ext)_d$(var.FreethreadedPydTag).pyd" />
             </Component>
             <Component Id="freethreaded_$(var.ext)_d.pdb" Directory="DLLs" Guid="*">
-                <File Name="$(var.ext)_d$(var.FreethreadedPydTag).pdb" />
+                <File Name="$(var.ext)_d$(var.FreethreadedPydTag).pdb" Source="!(bindpath.build_t)\$(var.ext)_d$(var.FreethreadedPydTag).pdb" />
             </Component>
             
             <?endforeach ?>
             
             <Component Id="venvlaunchert_d.exe" Directory="Lib_venv_scripts_nt__freethreaded" Guid="*">
-                <File Name="venvlaunchert_d.exe" KeyPath="yes" />
-                <File Name="venvlaunchert_d.pdb" />
+                <File Name="venvlaunchert_d.exe" Source="!(bindpath.build_t)\venvlaunchert_d.exe" KeyPath="yes" />
+                <File Name="venvlaunchert_d.pdb" Source="!(bindpath.build_t)\venvlaunchert_d.pdb" />
             </Component>
             <Component Id="venvwlaunchert_d.exe" Directory="Lib_venv_scripts_nt__freethreaded" Guid="*">
-                <File Name="venvwlaunchert_d.exe" KeyPath="yes" />
-                <File Name="venvwlaunchert_d.pdb" />
+                <File Name="venvwlaunchert_d.exe" Source="!(bindpath.build_t)\venvwlaunchert_d.exe" KeyPath="yes" />
+                <File Name="venvwlaunchert_d.pdb" Source="!(bindpath.build_t)\venvwlaunchert_d.pdb" />
             </Component>
         </ComponentGroup>
     </Fragment>
index 372c4823bce07f30d33d5481a708381ec40515a1..097af60715448f15103e034885402ac77ae19dc9 100644 (file)
         <LinkerBindInputPaths Include="$(PGOBuildPath);$(BuildPath)">
             <BindName></BindName>
         </LinkerBindInputPaths>
+        <!--
+        This looks repetitive, but we need to make sure that we override any
+        environment variable that changes the paths for free-threading so that
+        the binds are correct. Otherwise, we'd rely on defaults.
+        -->
+        <LinkerBindInputPaths Include="$(BuildPath32)" Condition="$(Platform) == 'x86'">
+            <BindName>build</BindName>
+        </LinkerBindInputPaths>
+        <LinkerBindInputPaths Include="$(BuildPath64)" Condition="$(Platform) == 'x64'">
+            <BindName>build</BindName>
+        </LinkerBindInputPaths>
+        <LinkerBindInputPaths Include="$(BuildPathARM64)" Condition="$(Platform) == 'ARM64'">
+            <BindName>build</BindName>
+        </LinkerBindInputPaths>
+        <LinkerBindInputPaths Include="$(BuildPath32t)" Condition="$(Platform) == 'x86'">
+            <BindName>build_t</BindName>
+        </LinkerBindInputPaths>
+        <LinkerBindInputPaths Include="$(BuildPath64t)" Condition="$(Platform) == 'x64'">
+            <BindName>build_t</BindName>
+        </LinkerBindInputPaths>
+        <LinkerBindInputPaths Include="$(BuildPathARM64t)" Condition="$(Platform) == 'ARM64'">
+            <BindName>build_t</BindName>
+        </LinkerBindInputPaths>
+
         <LinkerBindInputPaths Include="$(PySourcePath)">
             <BindName>src</BindName>
         </LinkerBindInputPaths>
         <LinkerBindInputPaths Include="$(CRTRedist)">
             <BindName>redist</BindName>
         </LinkerBindInputPaths>
+
         <LinkerBindInputPaths Include="$(BuildPath32)">
             <BindName>build32</BindName>
         </LinkerBindInputPaths>
         <LinkerBindInputPaths Include="$(BuildPathARM64)">
             <BindName>buildarm64</BindName>
         </LinkerBindInputPaths>
+        <LinkerBindInputPaths Include="$(BuildPath32t)">
+            <BindName>build32t</BindName>
+        </LinkerBindInputPaths>
+        <LinkerBindInputPaths Include="$(BuildPath64t)">
+            <BindName>build64t</BindName>
+        </LinkerBindInputPaths>
+        <LinkerBindInputPaths Include="$(BuildPathARM64t)">
+            <BindName>buildarm64t</BindName>
+        </LinkerBindInputPaths>
     </ItemGroup>
 
     <Target Name="_ValidateMsiProps" BeforeTargets="PrepareForBuild">
index 44a58581686a4f7b49386d43eb36c07572e599ee..bc3657067a8da2e7786091d803c0a9681f8c33e5 100644 (file)
@@ -145,10 +145,15 @@ def compile_c_extension(
         str(MOD_DIR.parent.parent.parent / "Parser" / "lexer"),
         str(MOD_DIR.parent.parent.parent / "Parser" / "tokenizer"),
     ]
+    library_dirs: list[str] = []
     if sys.platform == "win32":
         # HACK: The location of pyconfig.h has moved within our build, and
         # setuptools hasn't updated for it yet. So add the path manually for now
-        include_dirs.append(pathlib.Path(sysconfig.get_config_h_filename()).parent)
+        include_dirs.append(str(pathlib.Path(sysconfig.get_config_h_filename()).parent))
+        if sysconfig.is_python_build():
+            # HACK: Our output directory for free-threaded builds has moved, and so
+            # tests running in-tree require our sys.executable directory for libs
+            library_dirs.append(str(pathlib.Path(sys.executable).parent))
     extension = Extension(
         extension_name,
         sources=[generated_source_path],
@@ -161,6 +166,7 @@ def compile_c_extension(
     fixup_build_ext(cmd)
     cmd.build_lib = str(source_file_path.parent)
     cmd.include_dirs = include_dirs
+    cmd.library_dirs = library_dirs
     if build_dir:
         cmd.build_temp = build_dir
     cmd.ensure_finalized()