Skip to content

Emscripten trampolines not quite right since #106219 #121700

Description

@hoodmane

Bug report

Bug description:

pycore_emscripten_trampoline.h defines _PyCFunctionWithKeywords_TrampolineCall as a macro but pycore_object.h tries to declare it. This leads to a compile error. The fix is to delete the declaration from pycore_object.h.

--- a/Include/internal/pycore_object.h
+++ b/Include/internal/pycore_object.h
@@ -733,13 +733,7 @@ PyAPI_FUNC(PyObject*) _PyObject_GetState(PyObject *);
  * Third party code unintentionally rely on problematic fpcasts. The call
  * trampoline mitigates common occurrences of bad fpcasts on Emscripten.
  */
-#if defined(__EMSCRIPTEN__) && defined(PY_CALL_TRAMPOLINE)
-#define _PyCFunction_TrampolineCall(meth, self, args) \
-    _PyCFunctionWithKeywords_TrampolineCall( \
-        (*(PyCFunctionWithKeywords)(void(*)(void))(meth)), (self), (args), NULL)
-extern PyObject* _PyCFunctionWithKeywords_TrampolineCall(
-    PyCFunctionWithKeywords meth, PyObject *, PyObject *, PyObject *);
-#else
+#if !(defined(__EMSCRIPTEN__) && defined(PY_CALL_TRAMPOLINE))
 #define _PyCFunction_TrampolineCall(meth, self, args) \
     (meth)((self), (args))
 #define _PyCFunctionWithKeywords_TrampolineCall(meth, self, args, kw) \

CPython versions tested on:

CPython main branch

Operating systems tested on:

Other

Linked PRs

Activity

  1. added a commit that references this issue on Jul 13, 2024
  2. added a commit that references this issue on Jul 14, 2024
  3. added a commit that references this issue on Jul 14, 2024
  4. added a commit that references this issue on Jul 14, 2024
  5. added a commit that references this issue on Jul 17, 2024
  6. added a commit that references this issue on May 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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