Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
pyodide
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
pyodide
Commits
7b6053ed
Commit
7b6053ed
authored
May 30, 2018
by
Michael Droettboom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't pyimport repr multiple times
parent
3831cf86
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
14 deletions
+4
-14
src/pyodide.js
src/pyodide.js
+0
-11
src/pyproxy.c
src/pyproxy.c
+4
-3
No files found.
src/pyodide.js
View file @
7b6053ed
...
...
@@ -75,16 +75,6 @@ var languagePluginLoader = new Promise((resolve, reject) => {
return
promise
;
};
////////////////////////////////////////////////////////////
// Callable Python object shim
let
makeCallableProxy
=
(
obj
)
=>
{
var
clone
=
obj
.
clone
();
function
callProxy
(
args
)
{
return
clone
.
call
(
Array
.
from
(
arguments
),
{});
};
return
callProxy
;
};
////////////////////////////////////////////////////////////
// Loading Pyodide
let
wasmURL
=
`
${
baseURL
}
pyodide.asm.wasm`
;
...
...
@@ -112,7 +102,6 @@ var languagePluginLoader = new Promise((resolve, reject) => {
script
.
onload
=
()
=>
{
window
.
pyodide
=
pyodide
(
Module
);
window
.
pyodide
.
loadPackage
=
loadPackage
;
window
.
pyodide
.
makeCallableProxy
=
makeCallableProxy
;
};
document
.
head
.
appendChild
(
script
);
};
...
...
src/pyproxy.c
View file @
7b6053ed
...
...
@@ -127,9 +127,10 @@ EM_JS(int, pyproxy_init, (), {
get:
function
(
jsobj
,
jskey
)
{
if
(
jskey
===
'
toString
'
)
{
return
function
()
{
// TODO: Cache repr
var
repr
=
pyodide
.
pyimport
(
'
repr
'
);
return
repr
(
jsobj
);
if
(
window
.
pyodide
.
repr
===
undefined
)
{
window
.
pyodide
.
repr
=
window
.
pyodide
.
pyimport
(
'
repr
'
);
}
return
window
.
pyodide
.
repr
(
jsobj
);
}
}
else
if
(
jskey
===
'$$'
)
{
return
jsobj
[
'$$'
];
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment