GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||
GeezerVison is showing github.com — gh-156780: Emscripten: support building CPython with static linking by clementperon · Pull Request #156781 · python/cpython Conversation
|
|
@hoodmane 👀 maybe ? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Maybe let's start with a PR that adds the I think rather than using #ifdef __EMSCRIPTEN__ __attribute__((constructor)) void _PyEmscripten_Constructor(void) { _PyEmscripten_BeforeMain(); }
And of course as traditional we need much less prose since Claude is as rambly as usual. Please rewrite all the comments and the commit message by hand. I find that helps cut them down to a more reasonable length. Of course, it's likely that any of this will bit rot without test coverage. cc @freakboy3742 WDYT? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
e0433ec to
c89eb2f
Compare
|
@hoodmane as you suggest move to a dedicated object file + reword commit + add a test |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
c89eb2f to
2e46f9a
Compare
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
+1 to this as an approach to landing the changes.
I agree that linking into the mainline is a preferable approach to a runtime flag. As for where to put it - I can definitely see the argument for using
+1 to this as well. Claude's predilection for extraneous verbositude is usually contrary to the underlying goals of effective communication :-) |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
fa3261b to
ee90cfa
Compare
There was an error while loading. Please reload this page.
|
@hoodmane EM_JS_DEPS has been merged thanks to @freakboy3742. I will rework a bit this PR + clean commit message & comment. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
5417e3e to
7c1f523
Compare
18d7011 to
1eaadc6
Compare
|
Rebase on top of #157238 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
f96de99 to
afd1a38
Compare
|
@hoodmane can I have again your feedback on this PR please 🙏 Thanks |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Running main() under WebAssembly.promising only makes sense when Python is the program. Move the wrapper into Programs/emscripten_beforemain.c, linked into the interpreter but not into libpython, and let the runtime shut down normally afterwards so atexit handlers run and buffered output is flushed. FS.createAsyncInputDevice() stays in libpython. Co-Authored-By: Claude Fable 5.1 <[email protected]>
…() wrapper Suspending in fd_read or poll needs a promising entry point, which libpython no longer sets up itself. Check Module.Py_EmscriptenStackSwitching, set by the interpreter's wrapper, instead of WebAssembly.promising alone. An embedder with its own promising entry point sets the flag. Co-Authored-By: Claude Fable 5.1 <[email protected]>
Link libpython.a into a program whose main() is not Python's, without -sMAIN_MODULE or the interpreter's link flags, and run a script that imports from the stdlib, calls through the trampoline and polls. Platforms/emscripten/web_embed_test/run_test.sh builds and runs it in CI. Co-Authored-By: Claude Fable 5.1 <[email protected]>
|
@freakboy3742 what do you think of this PR ? Do you want me to update something ? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Keep the JavaScript setup in emscripten_syscalls.c and only the constructor in the interpreter object. Restore the existing live-runtime exit behavior and omit the constructor when syscall overrides are disabled. Add a smoke test that resumes main after an Emscripten callback and verifies its exit status.
afd1a38 to
09b9faf
Compare
|
@hoodmane thanks for your review, I hope i understand correctly what you wanted |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
The main() wrapper is unchanged from main, so there is nothing new to cover. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your patience @clementperon. Lgtm.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Thanks for your review ! |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I think this all makes sense, with one minor tweak related to making the Py_EmscriptenStackSwitching symbol private. Thanks for the PR!
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
Emscripten: static (non-MAIN_MODULE) builds fail at startup on dynamic-linking-only JS helpers
There was an error while loading. Please reload this page.