Skip to content

gh-156780: Emscripten: drop the trampoline's dependence on exports - #157238

Merged
freakboy3742 merged 1 commit into
python:mainfrom
clementperon:emscripten-trampoline-static
Sep 11, 2026
Merged

freakboy3742 merged 1 commit into
python:mainfrom
clementperon:emscripten-trampoline-static

Conversation

@clementperon

Copy link
Copy Markdown
Contributor

Split out of #156781 as requested by @hoodmane.

The call trampoline exports _PyRuntime's address itself and takes over a placeholder's function table slot instead of calling addFunction(), so it no longer needs _PyRuntime in -sEXPORTED_FUNCTIONS or -sALLOW_TABLE_GROWTH. __PyRuntime is dropped from the interpreter's export list.

Tested with the CI configuration: the wasm-gc trampoline is picked up and test_capi, test_builtin, test_functools pass.

🤖 Generated with Claude Code

@clementperon

Copy link
Copy Markdown
Contributor Author

@hoodmane hoodmane left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally looks good to me, modulo a couple of comments.

Comment thread Python/emscripten_trampoline.c Resolved

@hoodmane hoodmane left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks reasonable to me aside from a couple of comments.

@clementperon
clementperon force-pushed the emscripten-trampoline-static branch 3 times, most recently from 0c9e930 to fe2b470 Compare September 10, 2026 08:19
The trampoline exports _PyRuntime's address itself and reuses a
placeholder's table slot, so libpython no longer needs
-sEXPORTED_FUNCTIONS=__PyRuntime or a growable function table.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

@freakboy3742 freakboy3742 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me - Thanks!

Can I ask again that you don't force-push commits. We don't care about having a "clean" commit history, because we use merge commits when a PR is accepted; force pushes mean we lose context for review history.

@freakboy3742
freakboy3742 merged commit d0b2e07 into python:main Sep 11, 2026
56 checks passed
clin1234 pushed a commit to clin1234/cpython that referenced this pull request Sep 12, 2026
…rts (python#157238)

The trampoline exports _PyRuntime's address itself and reuses a
placeholder's table slot, so libpython no longer needs
-sEXPORTED_FUNCTIONS=__PyRuntime or a growable function table.

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
johnslavik pushed a commit to johnslavik/cpython that referenced this pull request Sep 14, 2026
…rts (python#157238)

The trampoline exports _PyRuntime's address itself and reuses a
placeholder's table slot, so libpython no longer needs
-sEXPORTED_FUNCTIONS=__PyRuntime or a growable function table.

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

3 participants