Skip to content

Emscripten: Use updated WebAssembly type reflection proposal #121698

@hoodmane

Description

@hoodmane

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    type-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions