Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Brett Cannon <brett@python.org>
  • Loading branch information
tiran and brettcannon committed Apr 2, 2022
1 parent 934bad8 commit 413398a
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions Lib/test/support/threading_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 413398a

Please sign in to comment.