mirror of https://github.com/pyodide/pyodide.git
Fix leak in to_js of dictionary (#4853)
This commit is contained in:
parent
e29a300e71
commit
df9d1773d5
|
@ -16,6 +16,9 @@ myst:
|
|||
|
||||
## Unreleased
|
||||
|
||||
- {{ Fix }} Don't leak the values in a dictionary when applying `to_js` to it.
|
||||
{pr}`4853`
|
||||
|
||||
### Packages
|
||||
|
||||
- Upgraded `scikit-learn` to 1.5 {pr}`4823`
|
||||
|
|
|
@ -275,6 +275,7 @@ _python2js_dict(ConversionContext* context, PyObject* x)
|
|||
FAIL_IF_MINUS_ONE(
|
||||
context->dict_add_keyvalue(context, jsdict, jskey, jsval));
|
||||
}
|
||||
Py_CLEAR(item);
|
||||
}
|
||||
FAIL_IF_ERR_OCCURRED();
|
||||
if (context->dict_postprocess) {
|
||||
|
|
|
@ -2200,3 +2200,12 @@ def test_bind_construct(selenium):
|
|||
A = A.bind_sig(A_sig)
|
||||
|
||||
A()
|
||||
|
||||
|
||||
@run_in_pyodide
|
||||
def test_to_js_no_leak(selenium):
|
||||
from js import Object
|
||||
from pyodide.ffi import to_js
|
||||
|
||||
d = {"key": Object()}
|
||||
to_js(d)
|
||||
|
|
Loading…
Reference in New Issue