Skip to content

Commit 0148bbb

Browse files
committed
webassembly/proxy_js: Revert back to converting Py None to JS null.
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 <damien@micropython.org>
1 parent c10a74b commit 0148bbb

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

ports/webassembly/proxy_js.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ function proxy_convert_mp_to_js_obj_jsside(value) {
188188
}
189189
if (kind === PROXY_KIND_MP_NONE) {
190190
// None
191-
obj = undefined;
191+
obj = null;
192192
} else if (kind === PROXY_KIND_MP_BOOL) {
193193
// bool
194194
obj = Module.getValue(value + 4, "i32") ? true : false;
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
false 1
22
true [ 1, 2, 3 ]
3-
true [ undefined, true, 1.2 ]
4-
true { tuple: [ 1, 2, 3 ], one: 1, list: [ undefined, true, 1.2 ] }
3+
true [ null, true, 1.2 ]
4+
true { tuple: [ 1, 2, 3 ], one: 1, list: [ null, true, 1.2 ] }

tests/ports/webassembly/run_python_async.mjs.exp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ py 1
2323
setTimeout resolved
2424
resolved value: 123
2525
py 2
26-
2 undefined
26+
2 null
2727
= TEST 4 ==========
2828
1
2929
py 1
@@ -35,4 +35,4 @@ py 3
3535
setTimeout B resolved
3636
resolved value: 456
3737
py 4
38-
2 undefined
38+
2 null

0 commit comments

Comments
 (0)