https://github.com/python/cpython/commit/4521718ca572ec8105fa5aa78f197c681a2c2907
commit: 4521718ca572ec8105fa5aa78f197c681a2c2907
branch: main
author: Brett Cannon <[email protected]>
committer: brettcannon <[email protected]>
date: 2026-10-27T14:40:17-07:00
summary:
GH-160135: Make sure the target triple makes it through `configure` (GH-160739)
files:
M Lib/test/test_io/test_fileio.py
M Platforms/WASI/_build.py
diff --git a/Lib/test/test_io/test_fileio.py b/Lib/test/test_io/test_fileio.py
index 21a160904a7f1e0..b89a381439bade5 100644
--- a/Lib/test/test_io/test_fileio.py
+++ b/Lib/test/test_io/test_fileio.py
@@ -565,10 +565,15 @@ def testAbles(self):
self.assertEqual(f.writable(), True)
if sys.platform != "darwin" and \
'bsd' not in sys.platform and \
- not sys.platform.startswith(('sunos', 'aix')):
- # Somehow /dev/tty appears seekable on some BSDs
+ not sys.platform.startswith(('sunos', 'aix')) and \
+ not is_wasi:
+ # Somehow /dev/tty appears seekable on some BSDs and
+ # WASI.
self.assertEqual(f.seekable(), False)
- self.assertEqual(f.isatty(), True)
+ if not is_wasi:
+ # wasi-libc special-cases stdin to be a TTY, but
+ # nothing else is supported.
+ self.assertEqual(f.isatty(), True)
f.close()
finally:
os.unlink(TESTFN)
diff --git a/Platforms/WASI/_build.py b/Platforms/WASI/_build.py
index 87b42ea6283951a..9ea92a58ef5bb34 100644
--- a/Platforms/WASI/_build.py
+++ b/Platforms/WASI/_build.py
@@ -181,8 +181,9 @@ def wasi_sdk_env(context):
for env_var, binary_name in list(env.items()):
env[env_var] = os.fsdecode(wasi_sdk_path / "bin" / binary_name)
- if not wasi_sdk_path.name.startswith("wasi-sdk"):
- for compiler in ["CC", "CPP", "CXX"]:
+ for compiler in ["CC", "CPP", "CXX"]:
+ env[compiler] += f" --target={context.host_triple}"
+ if not wasi_sdk_path.name.startswith("wasi-sdk"):
env[compiler] += f" --sysroot={sysroot}"
env["PKG_CONFIG_PATH"] = ""
@@ -229,7 +230,11 @@ def configure_wasi_python(context, working_dir):
"https://github.com/bytecodealliance/wasmtime"
)
host_runner = context.host_runner.format_map(args)
- env_additions = {"CONFIG_SITE": config_site, "HOSTRUNNER": host_runner}
+ env_additions = {
+ "CONFIG_SITE": config_site,
+ "HOSTRUNNER": host_runner,
+ "CFLAGS": f"{os.environ.get('CFLAGS', '')}
-DPY_CALL_TRAMPOLINE".strip(),
+ }
build_python = os.fsdecode(context.build_python_interpreter)
# The path to `configure` MUST be relative, else `python.wasm` is unable
# to find the stdlib due to Python not recognizing that it's being
@@ -239,7 +244,6 @@ def configure_wasi_python(context, working_dir):
f"--host={context.host_triple}",
f"--build={context.build_python_path.name}",
f"--with-build-python={build_python}",
- "CFLAGS=-DPY_CALL_TRAMPOLINE",
]
if context.is_debug:
configure.append("--with-pydebug")
_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]