Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bpo-40280: Detect if WASM platform supports threading #32243

Merged
merged 2 commits into from
Apr 2, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Apply suggestions from code review
Co-authored-by: Brett Cannon <brett@python.org>
tiran and brettcannon committed Apr 2, 2022
commit 413398a84b9965a3481e619701a152498b164fd9
9 changes: 5 additions & 4 deletions Lib/test/support/threading_helper.py
Original file line number Diff line number Diff line change
@@ -210,22 +210,23 @@ def __exit__(self, *exc_info):


def _can_start_thread() -> bool:
"""Detect if Python can start new threads
"""Detect if Python can start new threads.
Some WebAssembly platforms do not provide a working pthread
implementation. Thread support is stubbed and any attempt
to create a new thread fails.
- wasm32-wasi does not have threading
- wasm32-wasi does not have threading.
- wasm32-emscripten can be compiled with or without pthread
support. (-s USE_PTHREADS / __EMSCRIPTEN_PTHREADS__).
support (-s USE_PTHREADS / __EMSCRIPTEN_PTHREADS__).
"""
if sys.platform == "emscripten":
try:
_thread.start_new_thread(lambda: None, ())
except RuntimeError:
return False
return True
else:
return True
elif sys.platform == "wasi":
return False
else: