[issue40280] Consider supporting emscripten/webassembly as a build target

Ethan Smith report at bugs.python.org
Thu May 20 19:49:28 EDT 2021


Ethan Smith <ethan at ethanhs.me> added the comment:

I think the first thing we should do is figure out whether we want to support Emscripten or WASI (or both).

Emscripten uses Javascript polyfills for some syscalls, while WASI makes direct calls the VM it is running in. They both can use WebAssembly for executing the code. This means Emscripten has wider API support, but WASI is lighter weight in many ways.

I think starting with patches to support Emscripten would be best, as it is easier to target, then add support for WASI later.

I think supporting WASI has a lot of value, because it can be run deterministically, which would be great for data science (Imagine a jupyter notebook that runs the same everywhere!)

One issue with WASI, and may be an issue with Emscripten, is threads. In 3.8 (or 3.9?) threadless builds were removed. However, WebAssembly's threading API is not really meant to emulate pthread, and SharedArrayBuffer, the primitive it is built on, is disabled in several browsers due to Spectre concerns.

Would patches to re-add a threadless build mode be accepted?

----------
nosy: +ethan smith

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue40280>
_______________________________________


More information about the Python-bugs-list mailing list