diff options
author | Damien George <damien@micropython.org> | 2025-09-01 13:56:58 +1000 |
---|---|---|
committer | Damien George <damien@micropython.org> | 2025-09-26 14:07:07 +1000 |
commit | a319ddefa60750ce1b71b1fc7296fc2c69adc66a (patch) | |
tree | d0578e8bb5e57f5b60bedf73128a5b28200a1f60 /tests/inlineasm/asmbitops.py | |
parent | 9eddbb32f338a51b475b56891b334084633fbd0e (diff) |
webassembly: Improve identity and fix bug with lost JsProxy refs.
Commit ffa98cb0143c43af9f4c61142784a08a19f660c5 improved equality for
`JsProxy` objects so that, eg, `js.Object == js.Object` is true.
As mentioned in #17758, a further optimisation is to make identity work in
that case, eg `js.Object is js.Object` should be true (on the Python side).
This commit implements that, by keeping track of all `JsProxy` Python
objects and reusing them where possible: where the underlying JS ref is
equal, ie they point to the same JS object. That reduces memory churn and
gives better identity behaviour of JS objects proxied over to Python.
As part of this, a bug is fixed where JS objects can be freed while there's
still a `JsProxy` referring to that JS object. A test is added for that
exact scenario, and the test now passes.
Signed-off-by: Damien George <damien@micropython.org>
Diffstat (limited to 'tests/inlineasm/asmbitops.py')
0 files changed, 0 insertions, 0 deletions