Skip to content
Discussion options

You must be logged in to vote

Summarizing my experience with Pyodide reply at pyodide/pyodide#6065:

asyncio.run() is NOT working (now) on Firefox and Safari because they don't support JSPI (yet).

asyncio.create_task() is working in Chrome/Firefox/Safari, so can be used.

– However the best solution (for now) is to just call await, and mark the line to be ignored by static checkers.

– If the module is supposed to be used in both sync and async contexts, it should use branching and behave differently in different contexts, like using an existing event loop or starting a new one.

– CPython allows top-level await by setting PyCF_ALLOW_TOP_LEVEL_AWAIT, but there is no way to detect that setting statically by checkers.

–…

Replies: 1 comment 6 replies

Comment options

You must be logged in to vote
6 replies
@WebReflection
Comment options

@jolaf
Comment options

@ntoll
Comment options

@jolaf
Comment options

Answer selected by jolaf
@ntoll
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants