diff options
| author | Damien George <damien@micropython.org> | 2024-05-14 21:54:14 +1000 |
|---|---|---|
| committer | Damien George <damien@micropython.org> | 2024-05-16 12:44:43 +1000 |
| commit | 0148bbb495d6bacf66c00e730818cbb8eca45ffb (patch) | |
| tree | 075b560c6476dfdc91547f1267c6102aef29237c | |
| parent | c10a74b1625f668edddf9e76719584165473143b (diff) | |
webassembly/proxy_js: Revert back to converting Py None to JS null.
This reverts part of commit fa23e4b093f81f03a24187c7ea0c928a9b4a661b, 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>
| -rw-r--r-- | ports/webassembly/proxy_js.js | 2 | ||||
| -rw-r--r-- | tests/ports/webassembly/py_proxy_to_js.mjs.exp | 4 | ||||
| -rw-r--r-- | tests/ports/webassembly/run_python_async.mjs.exp | 4 |
3 files changed, 5 insertions, 5 deletions
diff --git a/ports/webassembly/proxy_js.js b/ports/webassembly/proxy_js.js index 05d0f2da4..f1f273d6b 100644 --- a/ports/webassembly/proxy_js.js +++ b/ports/webassembly/proxy_js.js @@ -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; diff --git a/tests/ports/webassembly/py_proxy_to_js.mjs.exp b/tests/ports/webassembly/py_proxy_to_js.mjs.exp index 3fd38c2b5..279df7bdf 100644 --- a/tests/ports/webassembly/py_proxy_to_js.mjs.exp +++ b/tests/ports/webassembly/py_proxy_to_js.mjs.exp @@ -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 ] } diff --git a/tests/ports/webassembly/run_python_async.mjs.exp b/tests/ports/webassembly/run_python_async.mjs.exp index 827f853b9..f441bc5cf 100644 --- a/tests/ports/webassembly/run_python_async.mjs.exp +++ b/tests/ports/webassembly/run_python_async.mjs.exp @@ -23,7 +23,7 @@ py 1 setTimeout resolved resolved value: 123 py 2 -2 undefined +2 null = TEST 4 ========== 1 py 1 @@ -35,4 +35,4 @@ py 3 setTimeout B resolved resolved value: 456 py 4 -2 undefined +2 null |
