Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Fail fast with an explicit and clear error message if tail-calling is not
possible for MSVC builds on Windows. Patch by Chris Eibl.
9 changes: 9 additions & 0 deletions PCbuild/pythoncore.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -749,4 +749,13 @@
<Target Name="_DeletePyBuildDirTxt" BeforeTargets="PrepareForBuild">
<Delete Files="$(OutDir)pybuilddir.txt" />
</Target>

<Target Name="_CheckTailCalling" BeforeTargets="PrepareForBuild" Condition="'$(UseTailCallInterp)' == 'true' and $(PlatformToolset) != 'ClangCL'">
Comment thread
itamaro marked this conversation as resolved.
<Error Text="MSVC supports tail-calling only for x64."
Condition="$(Platform) != 'x64'" />
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not convinced this needs to be an error - if/when MSVC gets support, they may want to test it on CPython themselves before shipping, and we're just going to block them.

As with Debug, make it a warning if you really want, but ultimately it's up to the user to decide whether they're enabling a feature or not. We shouldn't prevent users from doing what they want to do.

<Error Text="Platform toolset >= v145 is required for tail-calling."
Condition="$(PlatformToolset.Replace('v', '0')) &lt; '145'" />
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can't do this check - PlatformToolset is an arbitrary string, you can't assume that it's comparable to a number in any meaningful way.

<Error Text="MSVC requires optimization to be enabled for tail-calling."
Condition="$(Configuration) == 'Debug'" />
Comment thread
itamaro marked this conversation as resolved.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why would we do this? It makes it annoyingly hard to set tail calling enabled in my environment and then choose between debug/release builds.

A warning is fine, if you really want, but a debug build is inherently without optimisations, so there's no reason to remind users that that's what they're getting.

</Target>
</Project>
Loading