Skip to content

Commit f3d03d3

Browse files
committed
Fix
1 parent 526e102 commit f3d03d3

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

Include/internal/pycore_runtime_structs.h

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -276,9 +276,13 @@ struct pyruntimestate {
276276
struct _Py_time_runtime_state time;
277277

278278
#if defined(__EMSCRIPTEN__) && defined(PY_CALL_TRAMPOLINE)
279-
// Used in "Python/emscripten_trampoline.c" to choose between type
280-
// reflection trampoline and EM_JS trampoline.
281-
int (*emscripten_trampoline)(PyCFunctionWithKeywords func);
279+
// Used in "Python/emscripten_trampoline.c" to choose between wasm-gc
280+
// trampoline and JavaScript trampoline.
281+
PyObject* (*emscripten_trampoline)(int* success,
282+
PyCFunctionWithKeywords func,
283+
PyObject* self,
284+
PyObject* args,
285+
PyObject* kw);
282286
#endif
283287

284288
/* All the objects that are shared by the runtime's interpreters. */

Python/emscripten_trampoline.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
#include <emscripten.h> // EM_JS, EM_JS_DEPS
44
#include <Python.h>
5+
#include "pycore_runtime.h" // _PyRuntime
56

67
// We use the _PyRuntime.emscripten_trampoline field to store a function pointer
78
// for a wasm-gc based trampoline if it works. Otherwise fall back to JS
@@ -41,7 +42,7 @@
4142
EMSCRIPTEN_KEEPALIVE const int _PyEM_EMSCRIPTEN_TRAMPOLINE_OFFSET = offsetof(_PyRuntimeState, emscripten_trampoline);
4243

4344
typedef PyObject* (*TrampolineFunc)(int* success,
44-
void* func,
45+
PyCFunctionWithKeywords func,
4546
PyObject* self,
4647
PyObject* args,
4748
PyObject* kw);
@@ -103,6 +104,7 @@ _PyEM_TrampolineCall(PyCFunctionWithKeywords func,
103104
if (trampoline == 0) {
104105
return _PyEM_TrampolineCall_JS(func, self, args, kw);
105106
}
107+
int success = 1;
106108
PyObject *result = trampoline(&success, func, self, args, kw);
107109
if (!success) {
108110
PyErr_SetString(PyExc_SystemError, "Handler takes too many arguments");

0 commit comments

Comments
 (0)