SIGN IN SIGN UP

Fix Windows py3.15 builds: constrain Cython < 3.3.0 and bump the cp315 numpy pin (#194618)

Fixes all five Windows `py3_15` binary builds.

## Root cause: Cython 3.3.0

**Cython 3.3.0 was released 2026-08-22 05:16 UTC.** It crashes with `STATUS_ACCESS_VIOLATION` (`0xC0000005`, decimal `3221225477`) under the **GIL-enabled** CPython 3.15 build on Windows, so every package pip has to build from an sdist dies in its PEP 517 hook.

The nightly history matches exactly:

| Nightly | py3.15 | py3.15t |
|---|---|---|
| 08-20 | ✅ | ✅ |
| 08-21 | ✅ | ✅ |
| **08-22** (first run after the release) | ❌ | ✅ |
| 08-23 | ❌ | ✅ |
| 08-24 | ❌ | ✅ |

Nothing changed on the PyTorch side. The 08-21 passing log and the 08-24 failing log both use `python-3.15.0b3-amd64.exe`, pip 26.2.1 and setuptools 84.0.0, and there was **no setuptools/wheel/packaging release** in the window — Cython is the only build-time dependency that moved. py3.15**t** passes throughout, which pins the crash to the GIL-enabled build.

The error is easy to misread. meson projects report it as `Unknown compiler(s): [['cython'], ['cython3']]`, which looks like Cython is missing; meson's own detection output shows `cython -V -> 3221225477`. setuptools projects are quieter still: `exit code: 3221225477` with `[0 lines of output]`.

## The fix

**1. Pin `cython<3.3.0` in the outer env and pass `--no-build-isolation` for cp315.**

An earlier revision of this PR used `PIP_CONSTRAINT`. **That does not work**, and CI proved it — the constraint printed, and pyyaml still crashed. pip does not apply `PIP_CONSTRAINT` to its isolated build environments, which is exactly where the crashing Cython gets installed. Verified directly with pip 26.2.1, building pyyaml from its sdist:

```
no constraint                -> Successfully installed Cython-3.3.0 setuptools-84.0.0
PIP_CONSTRAINT=cython<3.3.0  -> Successfully installed Cython-3.3.0 setuptools-84.0.0
```

Identical. So the pin now goes in the outer environment (along with `setuptools` and `wheel`, which pip would otherwise have supplied to the isolated env itself) and isolation is turned off so sdist builds use it.

**2. Bump the cp315 numpy pin 2.5.1 → 2.5.2.** 2.5.1 has no cp315 Windows wheel and so was built from source; 2.5.2 ships `cp315-cp315` and `cp315-cp315t` win_amd64 wheels. Worth keeping regardless — avoiding a source build is faster and removes one exposure.

**3. Remove `provide_stdalign_shim()`.** It existed only for the cp315 numpy source build, and its docstring set exactly this exit condition: *"Remove once numpy ships cp315 Windows wheels or the runner SDK is >= 10.0.20348."*

## Why the numpy bump alone was not enough

CI confirmed it: with numpy resolving to a wheel, `pyyaml` failed next with the identical `3221225477`. PyYAML has **never** shipped a cp315 wheel (checked every release; 6.0.3 added cp314 and stops), and its `pyproject.toml` requires `Cython>=3.0` for py≥3.13, so it lands 3.3.0 in its build env. Pinning per package would be endless; pinning Cython covers numpy, pyyaml and anything else in `PIP_PACKAGES`.

## Test plan

Verified locally with pip 26.2.1:

```
pip install 'cython<3.3.0' setuptools wheel
pip install --no-cache-dir --no-build-isolation --no-binary=:all: pyyaml
# -> builds against Cython 3.2.9, no 3.3.0 fetched, PyYAML 6.0.3 installed
```

- `--no-build-isolation` is a no-op for the packages that resolve to wheels — confirmed for numpy 2.5.2, cmake, ninja, requests, typing_extensions.
- PyPI checks: Cython 3.3.0 uploaded 2026-08-22 05:16 (prior release 3.2.9 on 07-24); numpy 2.5.2 is the first release with a cp315 win_amd64 wheel; no PyYAML release has one; no setuptools/wheel/packaging release since 08-15.
- `ruff check` clean.

Windows confirmation needs a `ciflow/binaries` run on this PR.

## Risk

`--no-build-isolation` is scoped to cp315 only, but within that it applies to every install in `build_install_deps.py`. Any sdist build whose build requirements are not pre-installed will now fail loudly rather than silently provisioning them. Today only pyyaml builds from source on cp315, and `setuptools`/`wheel`/`cython` cover it — but that is the behaviour change to watch in the ciflow run.

## Upstream

The Cython crash is a genuine upstream bug affecting anyone doing a source build on Windows + CPython 3.15 (GIL-enabled). This routes around it and deserves a Cython report if one isn't already open.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/194618
Approved by: https://github.com/huydhn
A
Andrey Talman committed
bc42d25cfd6049e228964b30886f74d0a5c9854d
Parent: 76765bb
Committed by PyTorch MergeBot <pytorchmergebot@users.noreply.github.com> on 8/24/2026, 8:15:35 PM