From a893bf0bbf595f94b62f9b392dcd50431d6217d0 Mon Sep 17 00:00:00 2001 From: Jakub Vulgan Date: Fri, 8 May 2026 19:56:57 +0200 Subject: [PATCH] Fix C extension build for unsupported Python versions When the C source directory does not exist for the running Python version (e.g. 3.11+), the build silently skips compilation due to optional=True but still declares ext_modules, producing a wheel tagged as platform-specific (cp312-cp312-linux_x86_64) with no native code inside. Check whether c_src// exists before declaring the C extension. If it does not, fall back to pure-Python mode so the wheel is correctly tagged as py3-none-any. Regression introduced in 11d3511b4ccd9843690b29076c28b20202ee82a2 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index e77ce33..a08b793 100755 --- a/setup.py +++ b/setup.py @@ -221,7 +221,7 @@ def get_ext_module_1(optional): ) if custom_arg is None: - if impl == "PyPy": + if impl == "PyPy" or not c_src_path.exists(): custom_arg = "py" else: custom_arg = "py" if pure_py else "c"