Skip to content

Commit

Permalink
Disable Python limited API in free-threading wheels
Browse files Browse the repository at this point in the history
  • Loading branch information
Jackenmen committed Aug 2, 2024
1 parent 6e2b6b1 commit 2e4b8d1
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,23 @@
import sysconfig

from setuptools import Extension, setup


Py_GIL_DISABLED = sysconfig.get_config_var("Py_GIL_DISABLED")
macros = []
options = {}
if not Py_GIL_DISABLED:
macros.append(("Py_LIMITED_API", "0x030D0000"))
options["bdist_wheel"] = {"py_limited_api": "cp313"}

extensions = [
Extension(
name="audioop._audioop",
sources=["audioop/_audioop.c"],
depends=["audioop/_audioop.c.h"],
define_macros=[("Py_LIMITED_API", "0x030D0000")],
py_limited_api=True,
define_macros=macros,
py_limited_api=not Py_GIL_DISABLED,
)
]

options = {"bdist_wheel": {"py_limited_api": "cp313"}}

setup(ext_modules=extensions, options=options)

0 comments on commit 2e4b8d1

Please sign in to comment.