Skip to content

Commit

Permalink
webassembly/proxy_js: Revert back to converting Py None to JS null.
Browse files Browse the repository at this point in the history
This reverts part of commit fa23e4b, to
make it so that Python `None` converts to JavaScript `null` (and JavaScript
`null` already converts to Python `None`).  That's consistent with how the
`json` module converts these values back and forth.

Signed-off-by: Damien George <[email protected]>
  • Loading branch information
dpgeorge committed May 16, 2024
1 parent c10a74b commit 0148bbb
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion ports/webassembly/proxy_js.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ function proxy_convert_mp_to_js_obj_jsside(value) {
}
if (kind === PROXY_KIND_MP_NONE) {
// None
obj = undefined;
obj = null;
} else if (kind === PROXY_KIND_MP_BOOL) {
// bool
obj = Module.getValue(value + 4, "i32") ? true : false;
Expand Down
4 changes: 2 additions & 2 deletions tests/ports/webassembly/py_proxy_to_js.mjs.exp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
false 1
true [ 1, 2, 3 ]
true [ undefined, true, 1.2 ]
true { tuple: [ 1, 2, 3 ], one: 1, list: [ undefined, true, 1.2 ] }
true [ null, true, 1.2 ]
true { tuple: [ 1, 2, 3 ], one: 1, list: [ null, true, 1.2 ] }
4 changes: 2 additions & 2 deletions tests/ports/webassembly/run_python_async.mjs.exp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ py 1
setTimeout resolved
resolved value: 123
py 2
2 undefined
2 null
= TEST 4 ==========
1
py 1
Expand All @@ -35,4 +35,4 @@ py 3
setTimeout B resolved
resolved value: 456
py 4
2 undefined
2 null

0 comments on commit 0148bbb

Please sign in to comment.