Skip to content

[BUG] Windows PyPy CFFI extensions become unimportable with setuptools 84.2.0 #5367

Open

Description

@viblo

setuptools version

setuptools>=84.2.0

Python version

PyPy 8.0.0 / Python 3.11.16

OS

Windows x86-64 (GitHub Actions windows-latest)

Additional environment information

No response

Description

Since setuptools 84.2.0, Windows PyPy extensions built with py_limited_api=True receive the filename _example.pyd instead of PyPy’s ABI-tagged filename, such as _example.pypy311-pp80-win_amd64.pyd. PyPy consequently cannot import them.

This affects CFFI extensions, including Pymunk. CFFI enables this flag expecting setuptools to ignore it on PyPy.

Observed with Windows x86-64, PyPy 8.0.0 / Python 3.11.16, CFFI 2.1.1, and setuptools 84.2.1. The filename-selection change is also present in 84.2.0; setuptools 84.0.0 worked.

Expected behavior

Preserve PyPy’s ABI-tagged extension suffix even when py_limited_api=True, rather than applying CPython’s stable-ABI filename rules.

How to Reproduce

On Windows with PyPy 3.11, install:

pypy3 -m pip install setuptools==84.2.1

Run this minimal filename-selection reproducer (no compiler required):

import sysconfig

from setuptools import Distribution, Extension
from setuptools.command.build_ext import build_ext

extension = Extension(
    "_example",
    sources=["example.c"],
    py_limited_api=True,
)
command = build_ext(Distribution({"ext_modules": [extension]}))
command.ensure_finalized()

print("EXT_SUFFIX:", sysconfig.get_config_var("EXT_SUFFIX"))
print("Filename:", command.get_ext_filename("_example"))

Output

With setuptools 84.2.1:

EXT_SUFFIX: .pypy311-pp80-win_amd64.pyd
Filename: _example.pyd

Expected, as with setuptools 84.0.0:

EXT_SUFFIX: .pypy311-pp80-win_amd64.pyd
Filename: _example.pypy311-pp80-win_amd64.pyd

Activity

  1. added
    Needs Triage
    on Oct 22, 2026
  2. viblo commented on Oct 22, 2026

    @viblo
    Author

    I did create a PR to fix in #5368 However, Im not completely sure if this is a setuptools issue, or if its a CFFI issue that should be fixed there. On the other hand, it did work until setuptools updated..

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

    Needs Triagebug

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions