Closed
Description
Feature or enhancement
I propose to remove dependency on WASIX. Instead Python should omit missing features or provide stubs when a feature cannot be disabled.
wasm32-wasi builds are depending on WASIX. WASIX provides stubs for POSIX functions that are not part of current WASI API, for example several socket functions and pthreads. The stubs are no-ops or return an error. WASIX was the simplest approach to boot strap WASI support.
Pitch
Removal of WASIX has several benefits for us:
- It is one less dependency that must be downloaded, compiled, installed, and injected into the build environment with CFLAGS and LDFLAGS.
- Missing features and functions are easier to detect. With WASIX an unsupported feature raises an exception at runtime. Without WASIX the function is not wrapped and missing features can be detected with
hasattr()
. - Feature detection and stubs are useful for people that try to port Python to other operating systems with limited POSIX compatibility.
Missing features in WASI that need attention:
- pthread API, these will be stubbed with
static inline
functions - netdb functions
getservbyname getservbyport gethostbyname gethostaddr getprotobyname
. They will be detected by configure.ac and handled with#ifdef HAVE_
checks. - socket functions
inet_ntoa inet_pton getpeername getsockname bind connect listen recvfrom sendto setsockopt socket
. They will be handled like missing netdb functions. - some missing constants like POLLPRIO and ESHUTDOWN
WASI does not support DNS lookup and NSS. Sockets are limited to read/write/close from a socket FD or accept call.