Skip to content

Commit 00478ff

Browse files
committed
pythongh-112984 Update Windows build for free-threaded builds
1 parent fb4cb7c commit 00478ff

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+138
-66
lines changed

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -111,10 +111,14 @@ PCbuild/*-pgo
111111
PCbuild/*.VC.db
112112
PCbuild/*.VC.opendb
113113
PCbuild/amd64/
114+
PCbuild/amd64t/
114115
PCbuild/arm32/
116+
PCbuild/arm32t/
115117
PCbuild/arm64/
118+
PCbuild/arm64t/
116119
PCbuild/obj/
117120
PCbuild/win32/
121+
PCbuild/win32t/
118122
Tools/unicode/data/
119123
/autom4te.cache
120124
/build/

PC/pyconfig.h.in

+14-5
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,9 @@ WIN32 is still required for the locale module.
9494
#endif
9595
#endif /* Py_BUILD_CORE || Py_BUILD_CORE_BUILTIN || Py_BUILD_CORE_MODULE */
9696

97+
/* Define to 1 if you want to disable the GIL */
98+
#undef Py_GIL_DISABLED
99+
97100
/* Compiler specific defines */
98101

99102
/* ------------------------------------------------------------------------*/
@@ -305,15 +308,24 @@ Py_NO_ENABLE_SHARED to find out. Also support MS_NO_COREDLL for b/w compat */
305308
/* not building the core - must be an ext */
306309
# if defined(_MSC_VER)
307310
/* So MSVC users need not specify the .lib
308-
file in their Makefile (other compilers are
309-
generally taken care of by distutils.) */
311+
file in their Makefile */
312+
# if defined(Py_GIL_DISABLED)
313+
# if defined(_DEBUG)
314+
# pragma comment(lib,"python313t_d.lib")
315+
# elif defined(Py_LIMITED_API)
316+
# pragma comment(lib,"python3t.lib")
317+
# else
318+
# pragma comment(lib,"python313t.lib")
319+
# endif /* _DEBUG */
320+
# else /* Py_GIL_DISABLED */
310321
# if defined(_DEBUG)
311322
# pragma comment(lib,"python313_d.lib")
312323
# elif defined(Py_LIMITED_API)
313324
# pragma comment(lib,"python3.lib")
314325
# else
315326
# pragma comment(lib,"python313.lib")
316327
# endif /* _DEBUG */
328+
# endif /* Py_GIL_DISABLED */
317329
# endif /* _MSC_VER */
318330
# endif /* Py_BUILD_CORE */
319331
#endif /* MS_COREDLL */
@@ -739,7 +751,4 @@ Py_NO_ENABLE_SHARED to find out. Also support MS_NO_COREDLL for b/w compat */
739751
/* Define if libssl has X509_VERIFY_PARAM_set1_host and related function */
740752
#define HAVE_X509_VERIFY_PARAM_SET1_HOST 1
741753

742-
/* Define if you want to disable the GIL */
743-
#undef Py_GIL_DISABLED
744-
745754
#endif /* !Py_CONFIG_H */

PCbuild/_asyncio.vcxproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
</PropertyGroup>
8080
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
8181
<PropertyGroup>
82-
<TargetExt>.pyd</TargetExt>
82+
<TargetExt>$(PyStdlibPydExt)</TargetExt>
8383
</PropertyGroup>
8484
<ImportGroup Label="ExtensionSettings">
8585
</ImportGroup>

PCbuild/_bz2.vcxproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
<PropertyGroup Label="Configuration" />
8181
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
8282
<PropertyGroup>
83-
<TargetExt>.pyd</TargetExt>
83+
<TargetExt>$(PyStdlibPydExt)</TargetExt>
8484
</PropertyGroup>
8585
<ImportGroup Label="ExtensionSettings">
8686
</ImportGroup>

PCbuild/_ctypes.vcxproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
</PropertyGroup>
8080
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
8181
<PropertyGroup>
82-
<TargetExt>.pyd</TargetExt>
82+
<TargetExt>$(PyStdlibPydExt)</TargetExt>
8383
</PropertyGroup>
8484
<ImportGroup Label="ExtensionSettings">
8585
</ImportGroup>

PCbuild/_ctypes_test.vcxproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
</PropertyGroup>
8181
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
8282
<PropertyGroup>
83-
<TargetExt>.pyd</TargetExt>
83+
<TargetExt>$(PyStdlibPydExt)</TargetExt>
8484
</PropertyGroup>
8585
<ImportGroup Label="ExtensionSettings">
8686
</ImportGroup>

PCbuild/_decimal.vcxproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
</PropertyGroup>
8080
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
8181
<PropertyGroup>
82-
<TargetExt>.pyd</TargetExt>
82+
<TargetExt>$(PyStdlibPydExt)</TargetExt>
8383
</PropertyGroup>
8484
<ImportGroup Label="ExtensionSettings">
8585
</ImportGroup>

PCbuild/_elementtree.vcxproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
</PropertyGroup>
8080
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
8181
<PropertyGroup>
82-
<TargetExt>.pyd</TargetExt>
82+
<TargetExt>$(PyStdlibPydExt)</TargetExt>
8383
</PropertyGroup>
8484
<ImportGroup Label="ExtensionSettings">
8585
</ImportGroup>

PCbuild/_hashlib.vcxproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
</PropertyGroup>
8080
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
8181
<PropertyGroup>
82-
<TargetExt>.pyd</TargetExt>
82+
<TargetExt>$(PyStdlibPydExt)</TargetExt>
8383
</PropertyGroup>
8484
<ImportGroup Label="ExtensionSettings">
8585
</ImportGroup>

PCbuild/_lzma.vcxproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
</PropertyGroup>
8080
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
8181
<PropertyGroup>
82-
<TargetExt>.pyd</TargetExt>
82+
<TargetExt>$(PyStdlibPydExt)</TargetExt>
8383
</PropertyGroup>
8484
<ImportGroup Label="ExtensionSettings">
8585
</ImportGroup>

PCbuild/_multiprocessing.vcxproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
</PropertyGroup>
8080
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
8181
<PropertyGroup>
82-
<TargetExt>.pyd</TargetExt>
82+
<TargetExt>$(PyStdlibPydExt)</TargetExt>
8383
</PropertyGroup>
8484
<ImportGroup Label="ExtensionSettings">
8585
</ImportGroup>

PCbuild/_overlapped.vcxproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
</PropertyGroup>
8080
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
8181
<PropertyGroup>
82-
<TargetExt>.pyd</TargetExt>
82+
<TargetExt>$(PyStdlibPydExt)</TargetExt>
8383
</PropertyGroup>
8484
<ImportGroup Label="ExtensionSettings">
8585
</ImportGroup>

PCbuild/_queue.vcxproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
</PropertyGroup>
8080
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
8181
<PropertyGroup>
82-
<TargetExt>.pyd</TargetExt>
82+
<TargetExt>$(PyStdlibPydExt)</TargetExt>
8383
</PropertyGroup>
8484
<ImportGroup Label="ExtensionSettings">
8585
</ImportGroup>

PCbuild/_socket.vcxproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
</PropertyGroup>
8080
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
8181
<PropertyGroup>
82-
<TargetExt>.pyd</TargetExt>
82+
<TargetExt>$(PyStdlibPydExt)</TargetExt>
8383
</PropertyGroup>
8484
<ImportGroup Label="ExtensionSettings">
8585
</ImportGroup>

PCbuild/_sqlite3.vcxproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
</PropertyGroup>
8080
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
8181
<PropertyGroup>
82-
<TargetExt>.pyd</TargetExt>
82+
<TargetExt>$(PyStdlibPydExt)</TargetExt>
8383
</PropertyGroup>
8484
<ImportGroup Label="ExtensionSettings">
8585
</ImportGroup>

PCbuild/_ssl.vcxproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
</PropertyGroup>
8080
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
8181
<PropertyGroup>
82-
<TargetExt>.pyd</TargetExt>
82+
<TargetExt>$(PyStdlibPydExt)</TargetExt>
8383
</PropertyGroup>
8484
<ImportGroup Label="ExtensionSettings">
8585
</ImportGroup>

PCbuild/_testbuffer.vcxproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
</PropertyGroup>
8181
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
8282
<PropertyGroup>
83-
<TargetExt>.pyd</TargetExt>
83+
<TargetExt>$(PyStdlibPydExt)</TargetExt>
8484
</PropertyGroup>
8585
<ImportGroup Label="ExtensionSettings">
8686
</ImportGroup>

PCbuild/_testcapi.vcxproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
</PropertyGroup>
8181
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
8282
<PropertyGroup>
83-
<TargetExt>.pyd</TargetExt>
83+
<TargetExt>$(PyStdlibPydExt)</TargetExt>
8484
</PropertyGroup>
8585
<ImportGroup Label="ExtensionSettings">
8686
</ImportGroup>

PCbuild/_testclinic.vcxproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
</PropertyGroup>
8181
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
8282
<PropertyGroup>
83-
<TargetExt>.pyd</TargetExt>
83+
<TargetExt>$(PyStdlibPydExt)</TargetExt>
8484
</PropertyGroup>
8585
<ImportGroup Label="ExtensionSettings">
8686
</ImportGroup>
@@ -107,4 +107,4 @@
107107
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
108108
<ImportGroup Label="ExtensionTargets">
109109
</ImportGroup>
110-
</Project>
110+
</Project>

PCbuild/_testclinic_limited.vcxproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
</PropertyGroup>
8080
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
8181
<PropertyGroup>
82-
<TargetExt>.pyd</TargetExt>
82+
<TargetExt>$(PyStdlibPydExt)</TargetExt>
8383
</PropertyGroup>
8484
<ImportGroup Label="ExtensionSettings">
8585
</ImportGroup>

PCbuild/_testconsole.vcxproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
</PropertyGroup>
8181
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
8282
<PropertyGroup>
83-
<TargetExt>.pyd</TargetExt>
83+
<TargetExt>$(PyStdlibPydExt)</TargetExt>
8484
</PropertyGroup>
8585
<ImportGroup Label="ExtensionSettings">
8686
</ImportGroup>

PCbuild/_testimportmultiple.vcxproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
</PropertyGroup>
8181
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
8282
<PropertyGroup>
83-
<TargetExt>.pyd</TargetExt>
83+
<TargetExt>$(PyStdlibPydExt)</TargetExt>
8484
</PropertyGroup>
8585
<ImportGroup Label="ExtensionSettings">
8686
</ImportGroup>

PCbuild/_testinternalcapi.vcxproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
</PropertyGroup>
8181
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
8282
<PropertyGroup>
83-
<TargetExt>.pyd</TargetExt>
83+
<TargetExt>$(PyStdlibPydExt)</TargetExt>
8484
</PropertyGroup>
8585
<ImportGroup Label="ExtensionSettings">
8686
</ImportGroup>

PCbuild/_testmultiphase.vcxproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
</PropertyGroup>
8181
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
8282
<PropertyGroup>
83-
<TargetExt>.pyd</TargetExt>
83+
<TargetExt>$(PyStdlibPydExt)</TargetExt>
8484
</PropertyGroup>
8585
<ImportGroup Label="ExtensionSettings">
8686
</ImportGroup>

PCbuild/_testsinglephase.vcxproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
</PropertyGroup>
8181
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
8282
<PropertyGroup>
83-
<TargetExt>.pyd</TargetExt>
83+
<TargetExt>$(PyStdlibPydExt)</TargetExt>
8484
</PropertyGroup>
8585
<ImportGroup Label="ExtensionSettings">
8686
</ImportGroup>

PCbuild/_tkinter.vcxproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
</PropertyGroup>
8080
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
8181
<PropertyGroup>
82-
<TargetExt>.pyd</TargetExt>
82+
<TargetExt>$(PyStdlibPydExt)</TargetExt>
8383
</PropertyGroup>
8484
<ImportGroup Label="ExtensionSettings">
8585
</ImportGroup>

PCbuild/_uuid.vcxproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
</PropertyGroup>
8181
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
8282
<PropertyGroup>
83-
<TargetExt>.pyd</TargetExt>
83+
<TargetExt>$(PyStdlibPydExt)</TargetExt>
8484
</PropertyGroup>
8585
<ImportGroup Label="ExtensionSettings">
8686
</ImportGroup>

PCbuild/_wmi.vcxproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
</PropertyGroup>
8181
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
8282
<PropertyGroup>
83-
<TargetExt>.pyd</TargetExt>
83+
<TargetExt>$(PyStdlibPydExt)</TargetExt>
8484
</PropertyGroup>
8585
<ImportGroup Label="ExtensionSettings">
8686
</ImportGroup>

PCbuild/_zoneinfo.vcxproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
</PropertyGroup>
8080
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
8181
<PropertyGroup>
82-
<TargetExt>.pyd</TargetExt>
82+
<TargetExt>$(PyStdlibPydExt)</TargetExt>
8383
</PropertyGroup>
8484
<ImportGroup Label="ExtensionSettings">
8585
</ImportGroup>

PCbuild/pyexpat.vcxproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
</PropertyGroup>
8080
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
8181
<PropertyGroup>
82-
<TargetExt>.pyd</TargetExt>
82+
<TargetExt>$(PyStdlibPydExt)</TargetExt>
8383
</PropertyGroup>
8484
<ImportGroup Label="ExtensionSettings">
8585
</ImportGroup>

PCbuild/pyproject.props

+10-3
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,13 @@
2323
<LinkIncremental Condition="$(Configuration) != 'Debug'">false</LinkIncremental>
2424
</PropertyGroup>
2525

26+
<PropertyGroup>
27+
<TargetNameExt>$(TargetName)$(TargetExt)</TargetNameExt>
28+
<_TargetNameSep>$(TargetNameExt.LastIndexOf(`.`))</_TargetNameSep>
29+
<TargetName>$(TargetNameExt.Substring(0, $(_TargetNameSep)))</TargetName>
30+
<TargetExt>$(TargetNameExt.Substring($(_TargetNameSep)))</TargetExt>
31+
</PropertyGroup>
32+
2633
<PropertyGroup Label="MSVC Bug Workarounds" Condition="$(VCToolsVersion) != ''">
2734
<_VCToolsVersion>$([System.Version]::Parse(`$(VCToolsVersion)`).Major).$([System.Version]::Parse(`$(VCToolsVersion)`).Minor)</_VCToolsVersion>
2835

@@ -36,7 +43,7 @@
3643
<_PlatformPreprocessorDefinition>_WIN32;</_PlatformPreprocessorDefinition>
3744
<_PlatformPreprocessorDefinition Condition="$(Platform) == 'x64'">_WIN64;</_PlatformPreprocessorDefinition>
3845
<_PlatformPreprocessorDefinition Condition="$(Platform) == 'x64' and $(PlatformToolset) != 'ClangCL'">_M_X64;$(_PlatformPreprocessorDefinition)</_PlatformPreprocessorDefinition>
39-
<_Py3NamePreprocessorDefinition>PY3_DLLNAME=L"$(Py3DllName)";</_Py3NamePreprocessorDefinition>
46+
<_Py3NamePreprocessorDefinition>PY3_DLLNAME=L"$(Py3DllName)$(PyDebugExt)";</_Py3NamePreprocessorDefinition>
4047
</PropertyGroup>
4148
<ItemDefinitionGroup>
4249
<ClCompile>
@@ -155,8 +162,8 @@ public override bool Execute() {
155162
</UsingTask>
156163

157164
<Target Name="KillPython" BeforeTargets="PrepareForBuild" Condition="'$(KillPython)' == 'true'">
158-
<Message Text="Killing any running python$(PyDebugExt)$(PyTestExt).exe instances..." Importance="high" />
159-
<KillPython FileName="$(OutDir)python$(PyDebugExt)$(PyTestExt).exe" />
165+
<Message Text="Killing any running $(PyExeName)$(PyDebugExt)$(PyTestExt).exe instances..." Importance="high" />
166+
<KillPython FileName="$(OutDir)$(PyExeName)$(PyDebugExt)$(PyTestExt).exe" />
160167
</Target>
161168

162169
<!--

0 commit comments

Comments
 (0)