webassembly/proxy_js: Convert JS undefined and JS null to Py None.

And change Py None conversion so it converts to JS undefined.

The semantics for conversion of these objects are then:
- Python None           -> JavaScript undefined
- JavaScript undefined  -> Python None
- JavaScript null       -> Python None

This follows Pyodide:
https://pyodide.org/en/stable/usage/type-conversions.html

Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
Damien George
2024-05-09 15:36:30 +10:00
parent a67e326cb9
commit fa23e4b093
4 changed files with 13 additions and 7 deletions

View File

@@ -1,4 +1,4 @@
false 1
true [ 1, 2, 3 ]
true [ null, true, 1.2 ]
true { tuple: [ 1, 2, 3 ], one: 1, list: [ null, true, 1.2 ] }
true [ undefined, true, 1.2 ]
true { tuple: [ 1, 2, 3 ], one: 1, list: [ undefined, true, 1.2 ] }

View File

@@ -23,7 +23,7 @@ py 1
setTimeout resolved
resolved value: 123
py 2
2 null
2 undefined
= TEST 4 ==========
1
py 1
@@ -35,4 +35,4 @@ py 3
setTimeout B resolved
resolved value: 456
py 4
2 null
2 undefined