mirror of https://github.com/pyodide/pyodide.git
Fix #332: Make pyproxy.apply work
This commit is contained in:
parent
584c61edc9
commit
17cd31dce3
|
@ -157,6 +157,7 @@ EM_JS(int, pyproxy_init, (), {
|
||||||
return result;
|
return result;
|
||||||
},
|
},
|
||||||
get: function (jsobj, jskey) {
|
get: function (jsobj, jskey) {
|
||||||
|
ptrobj = this.getPtr(jsobj);
|
||||||
if (jskey === 'toString') {
|
if (jskey === 'toString') {
|
||||||
return function() {
|
return function() {
|
||||||
if (self.pyodide.repr === undefined) {
|
if (self.pyodide.repr === undefined) {
|
||||||
|
@ -169,8 +170,16 @@ EM_JS(int, pyproxy_init, (), {
|
||||||
} else if (jskey === 'destroy') {
|
} else if (jskey === 'destroy') {
|
||||||
__pyproxy_destroy(this.getPtr(jsobj));
|
__pyproxy_destroy(this.getPtr(jsobj));
|
||||||
jsobj['$$']['ptr'] = null;
|
jsobj['$$']['ptr'] = null;
|
||||||
|
} else if (jskey == 'apply') {
|
||||||
|
return function(jsthis, jsargs) {
|
||||||
|
var idargs = Module.hiwire_new_value(jsargs);
|
||||||
|
var idresult = __pyproxy_apply(ptrobj, idargs);
|
||||||
|
var jsresult = Module.hiwire_get_value(idresult);
|
||||||
|
Module.hiwire_decref(idresult);
|
||||||
|
Module.hiwire_decref(idargs);
|
||||||
|
return jsresult;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
ptrobj = this.getPtr(jsobj);
|
|
||||||
var idkey = Module.hiwire_new_value(jskey);
|
var idkey = Module.hiwire_new_value(jskey);
|
||||||
var idresult = __pyproxy_get(ptrobj, idkey);
|
var idresult = __pyproxy_get(ptrobj, idkey);
|
||||||
var jsresult = Module.hiwire_get_value(idresult);
|
var jsresult = Module.hiwire_get_value(idresult);
|
||||||
|
|
Loading…
Reference in New Issue