Content-Length: 314919 | pFad | http://github.com/micropython/micropython/commit/0148bbb495d6bacf66c00e730818cbb8eca45ffb

DF webassembly/proxy_js: Revert back to converting Py None to JS null. · micropython/micropython@0148bbb · GitHub
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

Diff for: ports/webassembly/proxy_js.js

+1-1
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;

Diff for: tests/ports/webassembly/py_proxy_to_js.mjs.exp

+2-2
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 ] }

Diff for: tests/ports/webassembly/run_python_async.mjs.exp

+2-2
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)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/micropython/micropython/commit/0148bbb495d6bacf66c00e730818cbb8eca45ffb

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy