Skip to content

Commit e2f51eb

Browse files
committed
Point to readme, improve readme
1 parent 778becc commit e2f51eb

File tree

2 files changed

+42
-29
lines changed

2 files changed

+42
-29
lines changed

Tools/wasm/README.md

+39-14
Original file line numberDiff line numberDiff line change
@@ -83,17 +83,17 @@ popd
8383
node --experimental-wasm-threads --experimental-wasm-bulk-memory builddir/emscripten-node/python.js
8484
```
8585

86-
## wasm32-emscripten limitations and issues
86+
# wasm32-emscripten limitations and issues
8787

88-
- Heap and stack are limited.
89-
- Most stdlib modules with a dependency on external libraries are missing:
90-
``ctypes``, ``readline``, ``sqlite3``, ``ssl``, and more.
91-
- Shared extension modules are not implemented yet. All extension modules
92-
are statically linked into the main binary.
93-
The experimental configure option ``--enable-wasm-dynamic-linking`` enables
94-
dynamic extensions.
95-
- Processes are not supported. System calls like fork, popen, and subprocess
96-
fail with ``ENOSYS`` or ``ENOSUP``.
88+
Emscripten before 3.1.8 has known bugs that can cause memory corruption and
89+
resource leaks. 3.1.8 contains several fixes for bugs in date and time
90+
functions.
91+
92+
## Network stack
93+
94+
- Python's socket module does not work with Emscripten's emulated POSIX
95+
sockets yet. Network modules like ``asyncio``, ``urllib``, ``selectors``,
96+
etc. are not available.
9797
- Only ``AF_INET`` and ``AF_INET6`` with ``SOCK_STREAM`` (TCP) or
9898
``SOCK_DGRAM`` (UDP) are available. ``AF_UNIX`` is not supported.
9999
- ``socketpair`` does not work.
@@ -102,8 +102,21 @@ node --experimental-wasm-threads --experimental-wasm-bulk-memory builddir/emscri
102102
does not resolve to a real IP address. IPv6 is not available.
103103
- The ``select`` module is limited. ``select.select()`` crashes the runtime
104104
due to lack of exectfd support.
105+
106+
## processes, threads, signals
107+
108+
- Processes are not supported. System calls like fork, popen, and subprocess
109+
fail with ``ENOSYS`` or ``ENOSUP``.
105110
- Signal support is limited. ``signal.alarm``, ``itimer``, ``sigaction``
106111
are not available or do not work correctly. ``SIGTERM`` exits the runtime.
112+
- Keyboard interrupt (CTRL+C) handling is not implemented yet.
113+
- Browser builds cannot start new threads. Node's web workers consume
114+
extra file descriptors.
115+
- Resource-related functions like ``os.nice`` and most functions of the
116+
``resource`` module are not available.
117+
118+
## file system
119+
107120
- Most user, group, and permission related function and modules are not
108121
supported or don't work as expected, e.g.``pwd`` module, ``grp`` module,
109122
``os.setgroups``, ``os.chown``, and so on. ``lchown`` and `lchmod`` are
@@ -117,23 +130,35 @@ node --experimental-wasm-threads --experimental-wasm-bulk-memory builddir/emscri
117130
and are disabled.
118131
- Large file support crashes the runtime and is disabled.
119132
- ``mmap`` module is unstable. flush (``msync``) can crash the runtime.
120-
- Resource-related functions like ``os.nice`` and most functions of the
121-
``resource`` module are not available.
133+
134+
## Misc
135+
136+
- Heap memory and stack size are limited. Recursion or extensive memory
137+
consumption can crash Python.
138+
- Most stdlib modules with a dependency on external libraries are missing,
139+
e.g. ``ctypes``, ``readline``, ``sqlite3``, ``ssl``, and more.
140+
- Shared extension modules are not implemented yet. All extension modules
141+
are statically linked into the main binary.
142+
The experimental configure option ``--enable-wasm-dynamic-linking`` enables
143+
dynamic extensions.
122144
- glibc extensions for date and time formatting are not available.
123145
- ``locales`` module is affected by musl libc issues,
124146
[bpo-46390](https://bugs.python.org/issue46390).
125147
- Python's object allocator ``obmalloc`` is disabled by default.
126148
- ``ensurepip`` is not available.
127149

128-
### wasm32-emscripten in browsers
150+
## wasm32-emscripten in browsers
129151

152+
- The interactive shell does not handle copy 'n paste and unicode support
153+
well.
130154
- The bundled stdlib is limited. Network-related modules,
131155
distutils, multiprocessing, dbm, tests and similar modules
132156
are not shipped. All other modules are bundled as pre-compiled
133157
``pyc`` files.
134158
- Threading is not supported.
159+
- In-memory file system (MEMFS) is not persistent and limited.
135160

136-
### wasm32-emscripten in node
161+
## wasm32-emscripten in node
137162

138163
Node builds use ``NODERAWFS``, ``USE_PTHREADS`` and ``PROXY_TO_PTHREAD``
139164
linker options.

Tools/wasm/python.html

+3-15
Original file line numberDiff line numberDiff line change
@@ -237,21 +237,9 @@ <h1>Simple REPL for Python WASM</h1>
237237
</div>
238238
<div id="info">
239239
The simple REPL provides a limited Python experience in the browser.
240-
<ul>
241-
<li>
242-
Large parts of the stdlib are not provided or do not work
243-
correctly.
244-
</li>
245-
<li>
246-
Python's socket and networking modules do not work with
247-
emulated POSIX sockets yet. asyncio and urllib are not
248-
available.
249-
</li>
250-
<li>In-memory file system is not persistent and limited.</li>
251-
<li>Sub processes and threading APIs are not available.</li>
252-
<li>Heap memory and stack size are restricted.</li>
253-
<li>Copy 'n paste and unicode support are limited.</li>
254-
</ul>
240+
<a href="https://github.com/python/cpython/blob/main/Tools/wasm/README.md">
241+
Tools/wasm/README.md</a> contains a list of known limitations and
242+
issues. Networking, subprocesses, and threading are not available.
255243
</div>
256244
</body>
257245
</html>

0 commit comments

Comments
 (0)