-
-
Notifications
You must be signed in to change notification settings - Fork 7.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
webassembly/asyncio: Fix case where a Promise is resolved with no arg.
Signed-off-by: Damien George <damien@micropython.org>
- Loading branch information
Showing
3 changed files
with
27 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// Test an asyncio task await'ing on a Promise that's resolved without an argument. | ||
|
||
const mp = await (await import(process.argv[2])).loadMicroPython(); | ||
|
||
globalThis.foo = new Promise((resolve) => { | ||
console.log(1); | ||
resolve(); // resolve without an argument | ||
console.log(2); | ||
}); | ||
|
||
mp.runPython(` | ||
import asyncio | ||
import js | ||
async def task(): | ||
print(3) | ||
print(await js.foo) | ||
print(4) | ||
asyncio.create_task(task()) | ||
`); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
1 | ||
2 | ||
3 | ||
None | ||
4 |