Skip to content

Commit 73df0e3

Browse files
committed
Prevent abi3 from being used with no-GIL interpreter
1 parent d1bea1b commit 73df0e3

File tree

1 file changed

+19
-10
lines changed

1 file changed

+19
-10
lines changed

setuptools/command/bdist_wheel.py

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -344,16 +344,7 @@ def get_tag(self) -> tuple[str, str, str]:
344344
impl = self.python_tag
345345
tag = (impl, "none", plat_name)
346346
else:
347-
impl_name = tags.interpreter_name()
348-
impl_ver = tags.interpreter_version()
349-
impl = impl_name + impl_ver
350-
# We don't work on CPython 3.1, 3.0.
351-
if self.py_limited_api and (impl_name + impl_ver).startswith("cp3"):
352-
impl = self.py_limited_api
353-
abi_tag = "abi3"
354-
else:
355-
abi_tag = str(get_abi_tag()).lower()
356-
tag = (impl, abi_tag, plat_name)
347+
tag = self._get_tag_inpure(plat_name)
357348
# issue gh-374: allow overriding plat_name
358349
supported_tags = [
359350
(t.interpreter, t.abi, plat_name) for t in tags.sys_tags()
@@ -363,6 +354,24 @@ def get_tag(self) -> tuple[str, str, str]:
363354
), f"would build wheel with unsupported tag {tag}"
364355
return tag
365356

357+
def _get_tag_impure(self, plat_name: str) -> tuple[str, str, str]:
358+
impl_name = tags.interpreter_name()
359+
impl_ver = tags.interpreter_version()
360+
impl = impl_name + impl_ver
361+
# We don't work on CPython 3.1, 3.0.
362+
if self.py_limited_api and impl.startswith("cp3"):
363+
if "t" in impl_ver:
364+
log.warn(
365+
f"Ignoring abi3 implied by py_limited_api={self.py_limited_api!r} - "
366+
f"incompatible with {impl!r} interpreter."
367+
)
368+
else:
369+
abi_tag = "abi3"
370+
impl = self.py_limited_api
371+
else:
372+
abi_tag = str(get_abi_tag()).lower()
373+
return (impl, abi_tag, plat_name)
374+
366375
def run(self):
367376
build_scripts = self.reinitialize_command("build_scripts")
368377
build_scripts.executable = "python"

0 commit comments

Comments
 (0)