Skip to content

win: GIL-enabled builds don't ship python3t.dll, breaking abi3t extensions #934

Description

@serjflint

Hi! I hit this problem while preparing for 3.15 on resvg-py - conda-forge/resvg-py-feedstock#12.

Branch main. Observed on win-64 with python 3.15.0rc2 h53f6dd8_102_cp315(conda-forge/label/python_rc).

Extensions linked against the free-threading stable ABI (abi3t, PEP 803) fail to import on GIL-enabled CPython 3.15:

ImportError: DLL load failed while importing resvg_py: The specified module could not be found.

The missing dependency is python3t.dll:

3.15 (fails)          3.14 (works)
├─ python3t.dll       └─ python3.dll (python)

Reproducible in any GIL-enabled 3.15 prefix on Windows:

python -c "import ctypes; ctypes.CDLL('python3t.dll')"

This is the intended path, not misuse: on 3.15 abi3t is compatible with both GIL-enabled and free-threaded builds, and PEP 803 encourages shipping one binary tagged abi3.abi3t. Upstream supports loading it — Misc/NEWS.d/3.15.0b1.rst:

Non-freethreaded builds on Windows now support extensions linked to python3t.dll, and will
include a copy of that library in normal installs that references the non-freethreaded runtime.

Cause

recipe/build_base.bat:83 sets THREAD= for GIL builds (t for free-threaded), so the root
staging loop

for %%x in (python%VERNODOTS%%THREAD%%_D%.dll python3%THREAD%%_D%.dll ...) do (

expands to python315.dll + python3.dll and never copies python3t.dll. The for %%x in (lib libs) loop below has the same gap for python3t.lib.

PCbuild/pcbuild.proj builds python3tdll.vcxproj unconditionally, and PCbuild/python.props sets PyDllName=python315 when DisableGil != true — so the GIL build tree already holds a python3t.dll that forwards to python315.dll.

Evidence

Hit in conda-forge/resvg-py-feedstock#12:
win_64 … cp315 fails while every Linux and macOS 3.15 job passes, since extension-module
leaves libpython unlinked on ELF/Mach-O and there is nothing to resolve there.

Suggested fix

Stage python3t.dll and python3t.lib in the non-free-threaded branch of build_base.bat, adjacent to python315.dll — which is what the upstream installer does
(PC/layout/main.py:200-206 @ v3.15.0rc2):

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions