python / python/cpython

Excessive stack usage for clang-cl debug builds on Windows

Open
#157,789 0 comments 0 reactions 1 assignee View on GitHub

@chris-eibl is already working on this.

Since Sep 19, 2026.

build OS-unsupported OS-windows
Dominant language
Python
Stars
77.2k
Forks
35.9k
PR merge metrics
PR metrics pending

Description

test.test_call.TestRecursion.test_margin_is_sufficient fails on the AMD64 Windows Server 2025 Clang 3.14 buildbot.

The table lists safe_margin before it is multiplied, because 3.14 and main use different extra percents
https://github.com/python/cpython/blob/5b343636bae9b89cb5632ca07b01e1570e24653d/Lib/test/test_call.py#L1105-L1107
and _testinternalcapi.get_stack_margin(), which is actually just _PyOS_STACK_MARGIN_BYTES.

branch compiler build safe_margin _PyOS_STACK_MARGIN_BYTES
main MSC v.1951 debug 20080 32768
main clang-cl 22.1.3 debug 26032 32768
main clang-cl 22.1.3 release 1200 16384
3.14 MSC v.1944 debug 23168 32768
3.14 clang-cl 22.1.3 debug 33920 32768
3.14 clang-cl 22.1.3 release 992 16384
3.14 clang-cl 22.1.3 debug with -Og 1536 32768

Using -Og drastically improves stack usage.

Linked PRs
  • gh-157791

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.