Skip to content

Silence experimental coroutine deprecation warnings#150788

Merged
hugovk merged 2 commits into
python:mainfrom
hugovk:3.16-silence-windows-warnings
Jun 2, 2026
Merged

Silence experimental coroutine deprecation warnings#150788
hugovk merged 2 commits into
python:mainfrom
hugovk:3.16-silence-windows-warnings

Conversation

@hugovk
Copy link
Copy Markdown
Member

@hugovk hugovk commented Jun 2, 2026

The Windows release build fails for today's 3.15 beta 2:

C:\...\MSVC\14.51.36231\include\experimental\coroutine(37,1): error C2338:
static assertion failed: 'error STL1011: The /await compiler option,
<experimental/coroutine>, <experimental/generator>, and <experimental/resumable>
are deprecated by Microsoft and will be REMOVED SOON. ... You can define
_SILENCE_EXPERIMENTAL_COROUTINE_DEPRECATION_WARNINGS to suppress this error for now.'

https://dev.azure.com/Python/cpython/_build/results?buildId=170819&view=logs&j=0108ec1a-385a-59f8-f3cd-2c3a968973ca&t=e19eaefe-6260-5118-3fc8-77764c035640

Here's Claude's summary, and it affects more than free-threaded debug AMD64. This PR does fix number 1.


Build: Azure Pipelines build 170819 (Python 3.15.0b2, free-threaded debug AMD64), 2026-06-02.

Symptom

python_uwp.vcxproj fails at the very end of the build:

C:\...\MSVC\14.51.36231\include\experimental\coroutine(37,1): error C2338:
static assertion failed: 'error STL1011: The /await compiler option,
<experimental/coroutine>, <experimental/generator>, and <experimental/resumable>
are deprecated by Microsoft and will be REMOVED SOON. ... You can define
_SILENCE_EXPERIMENTAL_COROUTINE_DEPRECATION_WARNINGS to suppress this error for now.'

Root cause

Toolchain bump on the agent image — not a code regression.

Build Date Toolchain Result
Previous 2026-05-10 VS 2022 / MSVC 14.44.35207 ✅ passes (deprecation = warning)
Failing 2026-06-02 VS 18 / MSVC 14.51.36231 ❌ fails (deprecation = static_assert)

PC/python_uwp.cpp transitively pulls in <experimental/coroutine> via its <winrt/...> includes under
/std:c++17. The file already silences the clang-equivalent warning but has no MSVC silencer.

Why the toolchain changed

windows-release/azure-pipelines.yml:174 (added in release-tools PR python/release-tools#346, Support optionally
building AMD64 with tailcalling
) routes tail-calling builds to the windows-2025-vs2026 agent image,
which ships VS 18:

vmImage: ${{ iif(eq(parameters.DoTailCalling, 'true'),
                  'windows-2025-vs2026',
                  parameters.vmImage) }}

Non-tailcall builds still go to the default windows-2025 (VS 2022) image and are unaffected.

Fix options (upstream CPython, not release-tools)

  1. Quick — add _SILENCE_EXPERIMENTAL_COROUTINE_DEPRECATION_WARNINGS to PC/python_uwp.cpp
    (matching the existing clang silencer) or to the preprocessor defines in PCbuild/python_uwp.vcxproj and
    PCbuild/pythonw_uwp.vcxproj.
  2. Proper — bump those two vcxprojs from /std:c++17 to /std:c++20; modern C++/WinRT uses the
    standard <coroutine> header in C++20 mode. PCbuild/_wmi.vcxproj is already on C++20.

Workaround to ship now

Queue the release build without DoTailCalling=true so it lands on the VS 2022 agent.

@hugovk hugovk requested a review from a team as a code owner June 2, 2026 13:21
@hugovk hugovk added needs backport to 3.15 pre-release feature fixes, bugs and security fixes and removed awaiting core review labels Jun 2, 2026
Copy link
Copy Markdown
Member

@zware zware left a comment

Choose a reason for hiding this comment

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

Looks fine to me, at least as a quick fix for a beta release :)

We recently got around this in CI by just disabling the UWP build entirely. I'm not up to date on whether we should just rip out the UWP entirely, but that might be an option for a permanent fix.

@hugovk hugovk enabled auto-merge (squash) June 2, 2026 14:48
@zooba
Copy link
Copy Markdown
Member

zooba commented Jun 2, 2026

We can't rip it out entirely yet, since 3.13 is still going to the Store, but disabling that part of the build for our release process is the way I'd do it. Suppressing the warning is fine too, if it works.

@hugovk hugovk merged commit 7241db1 into python:main Jun 2, 2026
52 checks passed
@hugovk hugovk deleted the 3.16-silence-windows-warnings branch June 2, 2026 14:55
@miss-islington-app
Copy link
Copy Markdown

Thanks @hugovk for the PR 🌮🎉.. I'm working now to backport this PR to: 3.15.
🐍🍒⛏🤖

@bedevere-app
Copy link
Copy Markdown

bedevere-app Bot commented Jun 2, 2026

GH-150794 is a backport of this pull request to the 3.15 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.15 pre-release feature fixes, bugs and security fixes label Jun 2, 2026
Comment thread PC/python_uwp.cpp
#if defined(__clang__)
#define _SILENCE_CLANG_COROUTINE_MESSAGE
#endif
#define _SILENCE_EXPERIMENTAL_COROUTINE_DEPRECATION_WARNINGS
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.

This nicely fits the silence I had to already do a while ago for clang :)

hugovk added a commit that referenced this pull request Jun 2, 2026
#150794)

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Zachary Ware <zach@python.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants