Skip to content

Commit 695fb1d

Browse files
committed
Fix crash formatting error message
1 parent fb7f3d3 commit 695fb1d

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

setuptools/command/bdist_wheel.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,10 +291,16 @@ def _validate_py_limited_api(self) -> None:
291291
raise ValueError(f"py-limited-api must match '{PY_LIMITED_API_PATTERN}'")
292292

293293
if sysconfig.get_config_var("Py_GIL_DISABLED"):
294+
# sys.abiflags is only defined on POSIX
295+
abiflags = getattr(sys, "abiflags", "")
296+
if abiflags:
297+
abinote = "(sys.abiflags={}). "
298+
else:
299+
abinote = ". "
294300
raise ValueError(
295301
f"`py_limited_api={self.py_limited_api!r}` not supported. "
296302
"`Py_LIMITED_API` is currently incompatible with "
297-
f"`Py_GIL_DISABLED` ({sys.abiflags=!r}). "
303+
f"`Py_GIL_DISABLED`{abinote}"
298304
"See https://github.com/python/cpython/issues/111506."
299305
)
300306

0 commit comments

Comments
 (0)