Skip to content

Emscripten: Use updated WebAssembly type reflection proposal #121698

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
hoodmane opened this issue Jul 13, 2024 · 0 comments
Closed

Emscripten: Use updated WebAssembly type reflection proposal #121698

hoodmane opened this issue Jul 13, 2024 · 0 comments
Labels
type-bug An unexpected behavior, bug, or error

Comments

@hoodmane
Copy link
Contributor

hoodmane commented Jul 13, 2024

Bug report

Bug description:

The way to use WebAssembly type reflection has changed from a static method WebAssembly.Function.type(wasmFunc) to an instance method wasmFunc.type(). We use the old version here:
https://github.com/python/cpython/blob/main/Python/emscripten_trampoline.c?plain=1#L46

This needs to be updated as follows:

--- a/Python/emscripten_trampoline.c
+++ b/Python/emscripten_trampoline.c
@@ -43,7 +43,7 @@ EM_JS(int, _PyEM_CountFuncParams, (PyCFunctionWithKeywords func),
     if (n !== undefined) {
         return n;
     }
-    n = WebAssembly.Function.type(wasmTable.get(func)).parameters.length;
+    n = wasmTable.get(func).type().parameters.length;
     _PyEM_CountFuncParams.cache.set(func, n);
     return n;
 }

CPython versions tested on:

CPython main branch

Operating systems tested on:

Other

Linked PRs

@hoodmane hoodmane added the type-bug An unexpected behavior, bug, or error label Jul 13, 2024
@hoodmane hoodmane changed the title Emscripten: WebAssembly type reflection experimental feature has changed Emscripten: Use updated WebAssembly type reflection proposal Jul 13, 2024
hoodmane added a commit to hoodmane/cpython that referenced this issue Jul 13, 2024
hoodmane added a commit to hoodmane/cpython that referenced this issue Jul 13, 2024
hoodmane added a commit to hoodmane/cpython that referenced this issue Jul 13, 2024
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Jul 14, 2024
…roposal (pythonGH-121699)

(cherry picked from commit cae1526)

Co-authored-by: Hood Chatham <roberthoodchatham@gmail.com>
encukou pushed a commit that referenced this issue Jul 14, 2024
…proposal (GH-121699) (GH-121745)

(cherry picked from commit cae1526)

Co-authored-by: Hood Chatham <roberthoodchatham@gmail.com>
@encukou encukou closed this as completed Jul 14, 2024
estyxx pushed a commit to estyxx/cpython that referenced this issue Jul 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

2 participants