https://github.com/python/cpython/commit/488174dc68f90217fd43aa95d87441cc6bad6a29
commit: 488174dc68f90217fd43aa95d87441cc6bad6a29
branch: main
author: Chris Eibl <[email protected]>
committer: zooba <[email protected]>
date: 2025-03-25T23:07:52Z
summary:
GH-131691: Fix exception handling setting for clang-cl on Windows (GH-131730)
The /EHa option for Clang-CL behaves differently than the same option for MSVC,
which is why we don't use it for both compilers.
files:
A Misc/NEWS.d/next/Build/2025-03-25-19-14-24.gh-issue-131691.2BgHU5.rst
M PCbuild/pyproject-clangcl.props
M PCbuild/pyproject.props
diff --git
a/Misc/NEWS.d/next/Build/2025-03-25-19-14-24.gh-issue-131691.2BgHU5.rst
b/Misc/NEWS.d/next/Build/2025-03-25-19-14-24.gh-issue-131691.2BgHU5.rst
new file mode 100644
index 00000000000000..b9567643cdb110
--- /dev/null
+++ b/Misc/NEWS.d/next/Build/2025-03-25-19-14-24.gh-issue-131691.2BgHU5.rst
@@ -0,0 +1,2 @@
+clang-cl on Windows needs option ``/EHa`` to support SEH (structured
+exception handling) correctly. Fix by Chris Eibl.
diff --git a/PCbuild/pyproject-clangcl.props b/PCbuild/pyproject-clangcl.props
index d949c37d562594..a574cf84ee5d6c 100644
--- a/PCbuild/pyproject-clangcl.props
+++ b/PCbuild/pyproject-clangcl.props
@@ -38,6 +38,14 @@
<ItemDefinitionGroup>
<ClCompile>
+ <!--
+ ExceptionHandling=Async sets MSVC's /EHa (-fasync-exceptions in clang)
+ For clang, /EHa just has a slightly different meaning compared to MSVC,
+ so this option is needed to handle SEH correctly
+ (even though MSVC does not need it).
+ Please see GH-131691 for details.
+ -->
+ <ExceptionHandling>Async</ExceptionHandling>
<AdditionalOptions>-Wno-deprecated-non-prototype -Wno-unused-label
-Wno-pointer-sign -Wno-incompatible-pointer-types-discards-qualifiers
-Wno-unused-function %(AdditionalOptions)</AdditionalOptions>
<AdditionalOptions Condition="'$(Platform)' == 'Win32'">-m32
%(AdditionalOptions)</AdditionalOptions>
<AdditionalOptions Condition="'$(Platform)' == 'x64'">-m64
%(AdditionalOptions)</AdditionalOptions>
diff --git a/PCbuild/pyproject.props b/PCbuild/pyproject.props
index b5a236ee3e37d5..4e414dc913b9d5 100644
--- a/PCbuild/pyproject.props
+++ b/PCbuild/pyproject.props
@@ -25,9 +25,6 @@
<LinkIncremental Condition="$(Configuration) !=
'Debug'">false</LinkIncremental>
</PropertyGroup>
- <!-- We need the above overridden OutDir, so this must be imported after
PropertyGroup -->
- <Import Project="pyproject-clangcl.props" Condition="$(PlatformToolset) ==
'ClangCL' and $(__PyprojectClangCl_Props_Imported) != 'true'" />
-
<PropertyGroup Condition="$(TargetExt) != ''">
<TargetNameExt>$(TargetName)$(TargetExt)</TargetNameExt>
<_TargetNameSep>$(TargetNameExt.LastIndexOf(`.`))</_TargetNameSep>
@@ -130,6 +127,13 @@
</Midl>
</ItemDefinitionGroup>
+ <!--
+ We need the overridden OutDir (PropertyGroup Label="Globals"),
+ and want to be able to override some ClCompile parameters,
+ so this must not be included erlier.
+ -->
+ <Import Project="pyproject-clangcl.props" Condition="$(PlatformToolset) ==
'ClangCL' and $(__PyprojectClangCl_Props_Imported) != 'true'" />
+
<UsingTask TaskName="KillPython" TaskFactory="CodeTaskFactory"
AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
<ParameterGroup>
<FileName Required="true" />
_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]