2121 "swresample" ,
2222]
2323
24+ if sys .implementation .name == "cpython" :
25+ is_cpython = True
26+ options = {"bdist_wheel" : {"py_limited_api" : "cp311" }}
27+ else :
28+ is_cpython = False
29+ options = {}
2430
2531# Monkey-patch Cython to not overwrite embedded signatures.
2632old_embed_signature = EmbedSignature ._embed_signature
@@ -142,6 +148,8 @@ def parse_cflags(raw_flags):
142148 include_dirs = [f"{ IMPORT_NAME } /filter" ] + extension_extra ["include_dirs" ],
143149 libraries = extension_extra ["libraries" ],
144150 library_dirs = extension_extra ["library_dirs" ],
151+ define_macros = [("Py_LIMITED_API" , 0x030B0000 )],
152+ py_limited_api = is_cpython ,
145153)
146154
147155compiler_directives = {
@@ -186,6 +194,8 @@ def parse_cflags(raw_flags):
186194 libraries = extension_extra ["libraries" ],
187195 library_dirs = extension_extra ["library_dirs" ],
188196 sources = [pyx_path ],
197+ define_macros = [("Py_LIMITED_API" , 0x030B0000 )],
198+ py_limited_api = is_cpython ,
189199 ),
190200 compiler_directives = compiler_directives ,
191201 build_dir = "src" ,
@@ -202,4 +212,5 @@ def parse_cflags(raw_flags):
202212 packages = find_packages (include = [f"{ IMPORT_NAME } *" ]),
203213 package_data = package_data ,
204214 ext_modules = ext_modules ,
215+ options = options ,
205216)
0 commit comments