aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Tools
diff options
context:
space:
mode:
Diffstat (limited to 'Tools')
-rw-r--r--Tools/build/generate-build-details.py2
-rw-r--r--Tools/cases_generator/analyzer.py2
-rw-r--r--Tools/wasm/wasi/__main__.py22
3 files changed, 16 insertions, 10 deletions
diff --git a/Tools/build/generate-build-details.py b/Tools/build/generate-build-details.py
index 5dc100b8b05..87e262065ec 100644
--- a/Tools/build/generate-build-details.py
+++ b/Tools/build/generate-build-details.py
@@ -123,7 +123,7 @@ def generate_data(schema_version: str) -> collections.defaultdict[str, Any]:
if has_static_library:
data['libpython']['static'] = os.path.join(LIBDIR, LIBRARY)
- data['c_api']['include'] = INCLUDEDIR
+ data['c_api']['headers'] = INCLUDEDIR
if LIBPC:
data['c_api']['pkgconfig_path'] = LIBPC
diff --git a/Tools/cases_generator/analyzer.py b/Tools/cases_generator/analyzer.py
index 825c72eaa16..96d64a27e0a 100644
--- a/Tools/cases_generator/analyzer.py
+++ b/Tools/cases_generator/analyzer.py
@@ -832,7 +832,7 @@ def compute_properties(op: parser.CodeDef) -> Properties:
)
error_with_pop = has_error_with_pop(op)
error_without_pop = has_error_without_pop(op)
- escapes = bool(escaping_calls)
+ escapes = bool(escaping_calls) or variable_used(op, "DECREF_INPUTS")
pure = False if isinstance(op, parser.LabelDef) else "pure" in op.annotations
no_save_ip = False if isinstance(op, parser.LabelDef) else "no_save_ip" in op.annotations
return Properties(
diff --git a/Tools/wasm/wasi/__main__.py b/Tools/wasm/wasi/__main__.py
index ba5faeb9e20..54ccc95157d 100644
--- a/Tools/wasm/wasi/__main__.py
+++ b/Tools/wasm/wasi/__main__.py
@@ -112,7 +112,7 @@ def call(command, *, quiet, **kwargs):
def build_platform():
"""The name of the build/host platform."""
- # Can also be found via `config.guess`.`
+ # Can also be found via `config.guess`.
return sysconfig.get_config_var("BUILD_GNU_TYPE")
@@ -128,6 +128,15 @@ def build_python_path():
return binary
+def build_python_is_pydebug():
+ """Find out if the build Python is a pydebug build."""
+ test = "import sys, test.support; sys.exit(test.support.Py_DEBUG)"
+ result = subprocess.run([build_python_path(), "-c", test],
+ stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE)
+ return bool(result.returncode)
+
+
@subdir(BUILD_DIR, clean_ok=True)
def configure_build_python(context, working_dir):
"""Configure the build/host Python."""
@@ -214,18 +223,15 @@ def configure_wasi_python(context, working_dir):
lib_dirs = list(python_build_dir.glob("lib.*"))
assert len(lib_dirs) == 1, f"Expected a single lib.* directory in {python_build_dir}"
lib_dir = os.fsdecode(lib_dirs[0])
- pydebug = lib_dir.endswith("-pydebug")
- python_version = lib_dir.removesuffix("-pydebug").rpartition("-")[-1]
- sysconfig_data = f"{wasi_build_dir}/build/lib.wasi-wasm32-{python_version}"
- if pydebug:
- sysconfig_data += "-pydebug"
+ python_version = lib_dir.rpartition("-")[-1]
+ sysconfig_data_dir = f"{wasi_build_dir}/build/lib.wasi-wasm32-{python_version}"
# Use PYTHONPATH to include sysconfig data which must be anchored to the
# WASI guest's `/` directory.
args = {"GUEST_DIR": "/",
"HOST_DIR": CHECKOUT,
"ENV_VAR_NAME": "PYTHONPATH",
- "ENV_VAR_VALUE": f"/{sysconfig_data}",
+ "ENV_VAR_VALUE": f"/{sysconfig_data_dir}",
"PYTHON_WASM": working_dir / "python.wasm"}
# Check dynamically for wasmtime in case it was specified manually via
# `--host-runner`.
@@ -245,7 +251,7 @@ def configure_wasi_python(context, working_dir):
f"--host={context.host_triple}",
f"--build={build_platform()}",
f"--with-build-python={build_python}"]
- if pydebug:
+ if build_python_is_pydebug():
configure.append("--with-pydebug")
if context.args:
configure.extend(context.args)