diff --git a/src/pyimport.c b/src/pyimport.c index d5608b1b5..be093e416 100644 --- a/src/pyimport.c +++ b/src/pyimport.c @@ -19,7 +19,6 @@ _pyimport(char* name) Py_DECREF(pyname); int idval = python2js(pyval); - Py_DECREF(pyval); return idval; } diff --git a/src/python2js.c b/src/python2js.c index ce6dd488d..158144634 100644 --- a/src/python2js.c +++ b/src/python2js.c @@ -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); } diff --git a/test/test_python.py b/test/test_python.py index 7503badc6..763dd08fc 100644 --- a/test/test_python.py +++ b/test/test_python.py @@ -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( """