diff --git a/Lib/sysconfig/__main__.py b/Lib/sysconfig/__main__.py index bc2197cfe79402..b0c00175afd7e9 100644 --- a/Lib/sysconfig/__main__.py +++ b/Lib/sysconfig/__main__.py @@ -162,7 +162,7 @@ def _print_config_dict(d, stream): def _get_pybuilddir(): pybuilddir = f'build/lib.{get_platform()}-{get_python_version()}' - if get_config_var('Py_DEBUG') == '1': + if get_config_var('Py_DEBUG'): pybuilddir += '-pydebug' return pybuilddir diff --git a/Misc/NEWS.d/next/Library/2025-03-31-17-15-09.gh-issue-127405.E7lPpD.rst b/Misc/NEWS.d/next/Library/2025-03-31-17-15-09.gh-issue-127405.E7lPpD.rst new file mode 100644 index 00000000000000..7a669b65c91d10 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2025-03-31-17-15-09.gh-issue-127405.E7lPpD.rst @@ -0,0 +1 @@ +Remove dead code in function ``sysconfig._get_pybuilddir``. Patch by Xuehai Pan. diff --git a/Tools/wasm/wasi.py b/Tools/wasm/wasi.py index da847c4ff86215..caf233c5ac4061 100644 --- a/Tools/wasm/wasi.py +++ b/Tools/wasm/wasi.py @@ -296,7 +296,7 @@ def main(): # Make sure the stack size will work for a pydebug # build. # Use 16 MiB stack. - "--wasm max-wasm-stack=16777216 " + "--wasm max-wasm-stack=33554432 " # Enable thread support; causes use of preview1. #"--wasm threads=y --wasi threads=y " # Map the checkout to / to load the stdlib from /Lib. diff --git a/Tools/wasm/wasm_build.py b/Tools/wasm/wasm_build.py index bcb80212362b71..9b6874a26e5448 100755 --- a/Tools/wasm/wasm_build.py +++ b/Tools/wasm/wasm_build.py @@ -329,10 +329,17 @@ def _check_wasi() -> None: # workaround for https://github.com/python/cpython/issues/95952 "HOSTRUNNER": ( "wasmtime run " - "--wasm max-wasm-stack=16777216 " + "--wasm max-wasm-stack=33554432 " "--wasi preview2 " "--dir {srcdir}::/ " - "--env PYTHONPATH=/{relbuilddir}/build/lib.wasi-wasm32-{version}:/Lib" + "--env PYTHONPATH=" + + ":".join( + ( + "/{relbuilddir}/build/lib.wasi-wasm32-{version}-pydebug", + "/{relbuilddir}/build/lib.wasi-wasm32-{version}", + "/Lib", + ) + ) ), "PATH": [WASI_SDK_PATH / "bin", os.environ["PATH"]], }, diff --git a/configure b/configure index a058553480ca5a..75dc073949c411 100755 --- a/configure +++ b/configure @@ -7886,7 +7886,7 @@ then : fi ;; #( WASI) : - HOSTRUNNER='wasmtime run --wasm max-wasm-stack=16777216 --wasi preview2=n --env PYTHONPATH=/$(shell realpath --relative-to $(abs_srcdir) $(abs_builddir))/$(shell cat pybuilddir.txt):/Lib --dir $(srcdir)::/' ;; #( + HOSTRUNNER='wasmtime run --wasm max-wasm-stack=33554432 --wasi preview2=n --env PYTHONPATH=/$(shell realpath --relative-to $(abs_srcdir) $(abs_builddir))/$(shell cat pybuilddir.txt):/Lib --dir $(srcdir)::/' ;; #( *) : HOSTRUNNER='' ;; @@ -9699,7 +9699,7 @@ then : fi - as_fn_append LDFLAGS_NODIST " -z stack-size=16777216 -Wl,--stack-first -Wl,--initial-memory=41943040" + as_fn_append LDFLAGS_NODIST " -z stack-size=33554432 -Wl,--stack-first -Wl,--initial-memory=41943040" ;; #( *) : @@ -35159,4 +35159,3 @@ if test "$ac_cv_header_stdatomic_h" != "yes"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: Your compiler or platform does have a working C11 stdatomic.h. A future version of Python may require stdatomic.h." >&5 printf "%s\n" "$as_me: Your compiler or platform does have a working C11 stdatomic.h. A future version of Python may require stdatomic.h." >&6;} fi - diff --git a/configure.ac b/configure.ac index 23bd81ed4431b9..52d65ac3956995 100644 --- a/configure.ac +++ b/configure.ac @@ -1638,7 +1638,7 @@ then dnl TODO: support other WASI runtimes dnl wasmtime starts the process with "/" as CWD. For OOT builds add the dnl directory containing _sysconfigdata to PYTHONPATH. - [WASI], [HOSTRUNNER='wasmtime run --wasm max-wasm-stack=16777216 --wasi preview2=n --env PYTHONPATH=/$(shell realpath --relative-to $(abs_srcdir) $(abs_builddir))/$(shell cat pybuilddir.txt):/Lib --dir $(srcdir)::/'], + [WASI], [HOSTRUNNER='wasmtime run --wasm max-wasm-stack=33554432 --wasi preview2=n --env PYTHONPATH=/$(shell realpath --relative-to $(abs_srcdir) $(abs_builddir))/$(shell cat pybuilddir.txt):/Lib --dir $(srcdir)::/'], [HOSTRUNNER=''] ) fi @@ -2420,7 +2420,7 @@ AS_CASE([$ac_sys_system], dnl gh-117645: Set the memory size to 40 MiB, the stack size to 16 MiB, dnl and move the stack first. dnl https://github.com/WebAssembly/wasi-libc/issues/233 - AS_VAR_APPEND([LDFLAGS_NODIST], [" -z stack-size=16777216 -Wl,--stack-first -Wl,--initial-memory=41943040"]) + AS_VAR_APPEND([LDFLAGS_NODIST], [" -z stack-size=33554432 -Wl,--stack-first -Wl,--initial-memory=41943040"]) ] )