Fix iodide/#1151: PyDict_GetItem returns a borrowed reference

This commit is contained in:
Michael Droettboom 2018-11-09 18:22:54 -05:00
parent 9093723bab
commit 0b2d4ab6d7
3 changed files with 7 additions and 2 deletions

View File

@ -19,7 +19,6 @@ _pyimport(char* name)
Py_DECREF(pyname);
int idval = python2js(pyval);
Py_DECREF(pyval);
return idval;
}

View File

@ -297,7 +297,6 @@ _python2js_cache(PyObject* x, PyObject* map)
if (result != HW_ERROR) {
result = hiwire_incref(result);
}
Py_DECREF(val);
} else {
result = _python2js(x, map);
}

View File

@ -183,6 +183,13 @@ def test_import_js(selenium):
assert result == 'Foo'
def test_pyimport_multiple(selenium):
"""See #1151"""
selenium.run("v = 0.123")
selenium.run_js("pyodide.pyimport('v')")
selenium.run_js("pyodide.pyimport('v')")
def test_pyproxy(selenium):
selenium.run(
"""