Skip to content

Commit

Permalink
gh-90473: Increase stack size, disable obmalloc on WASI (GH-92732)
Browse files Browse the repository at this point in the history
(cherry picked from commit d81d57e)

Co-authored-by: Christian Heimes <christian@python.org>
  • Loading branch information
miss-islington and tiran authored May 13, 2022
1 parent 715b070 commit c41667e
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Lib/test/support/os_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
% (TESTFN_UNENCODABLE, sys.getfilesystemencoding()))
TESTFN_UNENCODABLE = None
# macOS and Emscripten deny unencodable filenames (invalid utf-8)
elif sys.platform not in {'darwin', 'emscripten'}:
elif sys.platform not in {'darwin', 'emscripten', 'wasi'}:
try:
# ascii and utf-8 cannot encode the byte 0xff
b'\xff'.decode(sys.getfilesystemencoding())
Expand Down
5 changes: 4 additions & 1 deletion Lib/test/test_builtin.py
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,10 @@ def test_compile_top_level_await_no_coro(self):
msg=f"source={source} mode={mode}")


@unittest.skipIf(support.is_emscripten, "socket.accept is broken")
@unittest.skipIf(
support.is_emscripten or support.is_wasi,
"socket.accept is broken"
)
def test_compile_top_level_await(self):
"""Test whether code some top level await can be compiled.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Disable pymalloc and increase stack size on ``wasm32-wasi``.
25 changes: 21 additions & 4 deletions configure

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 17 additions & 4 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -1994,6 +1994,10 @@ AS_CASE([$ac_sys_system],
AC_DEFINE([_WASI_EMULATED_PROCESS_CLOCKS], [1], [Define to 1 if you want to emulate process clocks on WASI])
LIBS="$LIBS -lwasi-emulated-signal -lwasi-emulated-getpid -lwasi-emulated-process-clocks"
echo "#define _WASI_EMULATED_SIGNAL 1" >> confdefs.h
dnl increase initial memory and stack size, move stack first
dnl https://github.com/WebAssembly/wasi-libc/issues/233
AS_VAR_APPEND([LDFLAGS_NODIST], [" -z stack-size=524288 -Wl,--stack-first -Wl,--initial-memory=10485760"])
]
)

Expand Down Expand Up @@ -4046,13 +4050,17 @@ dnl the check does not work on cross compilation case...
#include <sys/types.h>
#include <sys/socket.h>]],
[[int domain = AF_INET6;]])],[
AC_MSG_RESULT(yes)
ipv6=yes
],[
AC_MSG_RESULT(no)
ipv6=no
])
AS_CASE([$ac_sys_system],
[WASI], [ipv6=no]
)
AC_MSG_RESULT([$ipv6])
if test "$ipv6" = "yes"; then
AC_MSG_CHECKING(if RFC2553 API is available)
AC_COMPILE_IFELSE([
Expand Down Expand Up @@ -4232,9 +4240,10 @@ AC_ARG_WITH(pymalloc,

if test -z "$with_pymalloc"
then
dnl default to yes except for wasm32-emscripten
dnl default to yes except for wasm32-emscripten and wasm32-wasi.
AS_CASE([$ac_sys_system],
[Emscripten], [with_pymalloc="no"],
[WASI], [with_pymalloc="no"],
[with_pymalloc="yes"]
)
fi
Expand Down Expand Up @@ -6680,7 +6689,11 @@ AS_CASE([$ac_sys_system],
)
],
[Emscripten/node*], [],
[WASI/*], []
[WASI/*], [
PY_STDLIB_MOD_SET_NA(
[_ctypes_test],
)
]
)
],
[PY_STDLIB_MOD_SET_NA([_scproxy])]
Expand Down

0 comments on commit c41667e

Please sign in to comment.