René's URL Explorer Experiment


Title: gh-156780: Emscripten: support building CPython with static linking by clementperon · Pull Request #156781 · python/cpython · GitHub

Open Graph Title: gh-156780: Emscripten: support building CPython with static linking by clementperon · Pull Request #156781 · python/cpython

X Title: gh-156780: Emscripten: support building CPython with static linking by clementperon · Pull Request #156781 · python/cpython

Description: Fixes #156780. Allow Emscripten libpython.a to be embedded without -sMAIN_MODULE or wrapping the application's main(). The wrapper no longer depends on resolveGlobalSymbol(). Keep the JavaScript setup in Python/emscripten_syscalls.c and invoke it from a constructor in Programs/emscripten_beforemain.c, linked only into the interpreter and _testembed. Preserve the existing _emscripten_exit_with_live_runtime() and Module.onExit behavior. Omit the constructor when Emscripten syscall overrides are disabled. fd_read and poll suspend only when Module.Py_EmscriptenStackSwitching is set. The interpreter sets this flag when entering its promising main(); embedders can opt in when providing their own promising entry point. Add CI smoke tests for static embedding and for an Emscripten callback completing while main() is suspended. The latter checks that main() resumes and its exit status is preserved. Validation with Emscripten 6.0.9 and Node 26.8.1: Rebuilt the dynamic-linking interpreter; test_capi.test_emscripten, test_builtin, test_json, test_sys, and test_functools passed. test_select was skipped because socket support was unavailable. Static embedding and suspended-main smoke tests passed. Also checked the suspended-main test with -sMAIN_MODULE; it fails against the previous wrapper and passes with this change. Verified that --disable-emscripten-syscalls omits the constructor and syscall objects from the configuration. Regenerated configure with CPython's regeneration script. Issue: gh-156780

Open Graph Description: Fixes #156780. Allow Emscripten libpython.a to be embedded without -sMAIN_MODULE or wrapping the application's main(). The wrapper no longer depends on resolveGlobalSymbol(). Keep the JavaScrip...

X Description: Fixes #156780. Allow Emscripten libpython.a to be embedded without -sMAIN_MODULE or wrapping the application's main(). The wrapper no longer depends on resolveGlobalSymbol(). Keep the JavaS...

Opengraph URL: https://github.com/python/cpython/pull/156781

X: @github

direct link

Domain: github.com

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:16a70156-ccfd-6d7d-5401-1f755e5ce2a1
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idD1EE:14700E:3AA02EB:4A6F8F5:6B01FC1E
html-safe-nonce9da68a18542ace3f21144e59f508dd96984397b1c788e0dcce14d621ef0fe0c2
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEMUVFOjE0NzAwRTozQUEwMkVCOjRBNkY4RjU6NkIwMUZDMUUiLCJ2aXNpdG9yX2lkIjoiODkzNzc0MjM1OTY4NTM2NDc2NiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmace4515ecffbdebb43c172db883808df942992cbc4b113beb3a65c1728aa17d3fc
hovercard-subject-tagpull_request:4413365661
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/python/cpython/pull/156781/files
twitter:imagehttps://avatars.githubusercontent.com/u/1859302?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/1859302?s=400&v=4
og:image:altFixes #156780. Allow Emscripten libpython.a to be embedded without -sMAIN_MODULE or wrapping the application's main(). The wrapper no longer depends on resolveGlobalSymbol(). Keep the JavaScrip...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/python/cpython git https://github.com/python/cpython.git
octolytics-dimension-user_id1525981
octolytics-dimension-user_loginpython
octolytics-dimension-repository_id81598961
octolytics-dimension-repository_nwopython/cpython
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id81598961
octolytics-dimension-repository_network_root_nwopython/cpython
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release423dbb54c5e7bfecc838eb387c1435eb3d0e760d
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/python/cpython/pull/156781/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fpull%2F156781%2Ffiles
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fpull%2F156781%2Ffiles
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=python%2Fcpython
Reloadhttps://github.com/python/cpython/pull/156781/files
Reloadhttps://github.com/python/cpython/pull/156781/files
Reloadhttps://github.com/python/cpython/pull/156781/files
pythonhttps://github.com/python
cpythonhttps://github.com/python/cpython
Codehttps://github.com/python/cpython
Issues5k+ (5k+)https://github.com/python/cpython/issues
Pull requests2.4k (2.4k)https://github.com/python/cpython/pulls
Actionshttps://github.com/python/cpython/actions
Projectshttps://github.com/python/cpython/projects
Security and qualityhttps://github.com/python/cpython/security
Insightshttps://github.com/python/cpython/insights
Sign up for GitHub https://github.com/signup?return_to=%2Fpython%2Fcpython%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fpython%2Fcpython%2Fissues%2Fnew%2Fchoose
freakboy3742https://github.com/freakboy3742
python:mainhttps://github.com/python/cpython/tree/main
clementperon:emscripten-static-linkinghttps://github.com/clementperon/cpython/tree/emscripten-static-linking
Conversation 26 https://github.com/python/cpython/pull/156781
Commits 6 https://github.com/python/cpython/pull/156781/commits
Checks 74 https://github.com/python/cpython/pull/156781/checks
Files changed https://github.com/python/cpython/pull/156781/files
Please reload this pagehttps://github.com/python/cpython/pull/156781/files
gh-156780: Emscripten: support building CPython with static linking https://github.com/python/cpython/pull/156781/files#top
Show all changes 6 commits https://github.com/python/cpython/pull/156781/files
bf034a6 gh-156780: Emscripten: move main() wrapping out of libpython clementperon Sep 8, 2026 https://github.com/python/cpython/pull/156781/commits/bf034a69eb5f3d8e934aad6c0b4c21968f97fcf8
9a86800 gh-156780: Emscripten: gate the suspending syscalls on the main() wra… clementperon Sep 8, 2026 https://github.com/python/cpython/pull/156781/commits/9a86800858499c032a00f177ae13537e5f2224ca
f0f808e gh-156780: Emscripten: add an embedding smoke test clementperon Sep 8, 2026 https://github.com/python/cpython/pull/156781/commits/f0f808ef6e86218ab55e2312b328762f6e5b8c12
09b9faf gh-156780: preserve Emscripten main wrapper behavior clementperon Oct 19, 2026 https://github.com/python/cpython/pull/156781/commits/09b9fafcaae4713e908e8179f078c74d0c06e7ce
84b96aa gh-156780: Emscripten: drop the promising_main test clementperon Oct 22, 2026 https://github.com/python/cpython/pull/156781/commits/84b96aa7ab2d6a07c90c88aa5218ea8c9f5bd502
139c1e2 Make stack-switching symbol private freakboy3742 Oct 22, 2026 https://github.com/python/cpython/pull/156781/commits/139c1e2150ded3deaa2176f2af3459e4974337a2
Clear filters https://github.com/python/cpython/pull/156781/files
Please reload this pagehttps://github.com/python/cpython/pull/156781/files
Please reload this pagehttps://github.com/python/cpython/pull/156781/files
reusable-emscripten.yml https://github.com/python/cpython/pull/156781/files#diff-69cd55d39fd5d528433ba06362a1c5c51a6787ae52ef0f38afe5162b3d466144
Makefile.pre.in https://github.com/python/cpython/pull/156781/files#diff-1f0a8db227d22005511b0d90f5339b97db345917b863954b3b3ccb9ec308767c
2026-09-01-23-32-22.gh-issue-156780.Qw3nRt.rst https://github.com/python/cpython/pull/156781/files#diff-b8ac62fa534e72b7913a2cf91437f636945a7ae7aa7743d09e3a1fc15d4ff7fa
_testinternalcapi.c https://github.com/python/cpython/pull/156781/files#diff-687f4a736f1f6ad4b6cd4ff65c8e0113408304e8d65530dbd41b3f59a081a126
main.c https://github.com/python/cpython/pull/156781/files#diff-eb93d3af1368b1b8a7b2f4d5743eeb76e7e8559d49b5db1098fcc99be8989097
run_test.sh https://github.com/python/cpython/pull/156781/files#diff-e83269f88c7d312be884e4e7c8343ab11e15153d22688734b502ac2d69e4d7f8
emscripten_beforemain.c https://github.com/python/cpython/pull/156781/files#diff-30a5a44df058445e9ebce660e7ce6c750cf316c402634469126206c80516d600
emscripten_syscalls.c https://github.com/python/cpython/pull/156781/files#diff-e21153994554acf95a199315fd29ba309c56809976a9329b934a0b920633f923
configure https://github.com/python/cpython/pull/156781/files#diff-90d08e583c4c9c6f391b2ae90f819f600a6326928ea9512c9e0c6d98e9f29ac2
configure.ac https://github.com/python/cpython/pull/156781/files#diff-49473dca262eeab3b4a43002adb08b4db31020d190caaad1594b47f1d5daa810
https://github.com/python/cpython/blob/main/.github/CODEOWNERS#L180
.github/workflows/reusable-emscripten.ymlhttps://github.com/python/cpython/pull/156781/files#diff-69cd55d39fd5d528433ba06362a1c5c51a6787ae52ef0f38afe5162b3d466144
View file https://github.com/clementperon/cpython/blob/139c1e2150ded3deaa2176f2af3459e4974337a2/.github/workflows/reusable-emscripten.yml
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/156781/{{ revealButtonHref }}
https://github.com/python/cpython/pull/156781/files#diff-69cd55d39fd5d528433ba06362a1c5c51a6787ae52ef0f38afe5162b3d466144
https://github.com/python/cpython/blob/main/.github/CODEOWNERS#L85
Makefile.pre.inhttps://github.com/python/cpython/pull/156781/files#diff-1f0a8db227d22005511b0d90f5339b97db345917b863954b3b3ccb9ec308767c
View file https://github.com/clementperon/cpython/blob/139c1e2150ded3deaa2176f2af3459e4974337a2/Makefile.pre.in
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/156781/{{ revealButtonHref }}
https://github.com/python/cpython/pull/156781/files#diff-1f0a8db227d22005511b0d90f5339b97db345917b863954b3b3ccb9ec308767c
https://github.com/python/cpython/pull/156781/files#diff-1f0a8db227d22005511b0d90f5339b97db345917b863954b3b3ccb9ec308767c
https://github.com/python/cpython/pull/156781/files#diff-1f0a8db227d22005511b0d90f5339b97db345917b863954b3b3ccb9ec308767c
https://github.com/python/cpython/pull/156781/files#diff-1f0a8db227d22005511b0d90f5339b97db345917b863954b3b3ccb9ec308767c
https://github.com/python/cpython/pull/156781/files#diff-1f0a8db227d22005511b0d90f5339b97db345917b863954b3b3ccb9ec308767c
https://github.com/python/cpython/pull/156781/files#diff-1f0a8db227d22005511b0d90f5339b97db345917b863954b3b3ccb9ec308767c
https://github.com/python/cpython/pull/156781/files#diff-1f0a8db227d22005511b0d90f5339b97db345917b863954b3b3ccb9ec308767c
https://github.com/python/cpython/pull/156781/files#diff-1f0a8db227d22005511b0d90f5339b97db345917b863954b3b3ccb9ec308767c
https://github.com/python/cpython/pull/156781/files#diff-1f0a8db227d22005511b0d90f5339b97db345917b863954b3b3ccb9ec308767c
https://github.com/python/cpython/pull/156781/files#diff-1f0a8db227d22005511b0d90f5339b97db345917b863954b3b3ccb9ec308767c
https://github.com/python/cpython/pull/156781/files#diff-1f0a8db227d22005511b0d90f5339b97db345917b863954b3b3ccb9ec308767c
https://github.com/python/cpython/pull/156781/files#diff-1f0a8db227d22005511b0d90f5339b97db345917b863954b3b3ccb9ec308767c
Misc/NEWS.d/next/Build/2026-09-01-23-32-22.gh-issue-156780.Qw3nRt.rsthttps://github.com/python/cpython/pull/156781/files#diff-b8ac62fa534e72b7913a2cf91437f636945a7ae7aa7743d09e3a1fc15d4ff7fa
View file https://github.com/clementperon/cpython/blob/139c1e2150ded3deaa2176f2af3459e4974337a2/Misc/NEWS.d/next/Build/2026-09-01-23-32-22.gh-issue-156780.Qw3nRt.rst
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/156781/{{ revealButtonHref }}
Modules/_testinternalcapi.chttps://github.com/python/cpython/pull/156781/files#diff-687f4a736f1f6ad4b6cd4ff65c8e0113408304e8d65530dbd41b3f59a081a126
View file https://github.com/clementperon/cpython/blob/139c1e2150ded3deaa2176f2af3459e4974337a2/Modules/_testinternalcapi.c
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/156781/{{ revealButtonHref }}
https://github.com/python/cpython/pull/156781/files#diff-687f4a736f1f6ad4b6cd4ff65c8e0113408304e8d65530dbd41b3f59a081a126
https://github.com/python/cpython/pull/156781/files#diff-687f4a736f1f6ad4b6cd4ff65c8e0113408304e8d65530dbd41b3f59a081a126
https://github.com/python/cpython/blob/main/.github/CODEOWNERS#L175
Platforms/emscripten/web_embed_test/main.chttps://github.com/python/cpython/pull/156781/files#diff-eb93d3af1368b1b8a7b2f4d5743eeb76e7e8559d49b5db1098fcc99be8989097
View file https://github.com/clementperon/cpython/blob/139c1e2150ded3deaa2176f2af3459e4974337a2/Platforms/emscripten/web_embed_test/main.c
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/156781/{{ revealButtonHref }}
https://github.com/python/cpython/blob/main/.github/CODEOWNERS#L175
Platforms/emscripten/web_embed_test/run_test.shhttps://github.com/python/cpython/pull/156781/files#diff-e83269f88c7d312be884e4e7c8343ab11e15153d22688734b502ac2d69e4d7f8
View file https://github.com/clementperon/cpython/blob/139c1e2150ded3deaa2176f2af3459e4974337a2/Platforms/emscripten/web_embed_test/run_test.sh
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/156781/{{ revealButtonHref }}
Programs/emscripten_beforemain.chttps://github.com/python/cpython/pull/156781/files#diff-30a5a44df058445e9ebce660e7ce6c750cf316c402634469126206c80516d600
View file https://github.com/clementperon/cpython/blob/139c1e2150ded3deaa2176f2af3459e4974337a2/Programs/emscripten_beforemain.c
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/156781/{{ revealButtonHref }}
https://github.com/python/cpython/blob/main/.github/CODEOWNERS#L179
Python/emscripten_syscalls.chttps://github.com/python/cpython/pull/156781/files#diff-e21153994554acf95a199315fd29ba309c56809976a9329b934a0b920633f923
View file https://github.com/clementperon/cpython/blob/139c1e2150ded3deaa2176f2af3459e4974337a2/Python/emscripten_syscalls.c
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/156781/{{ revealButtonHref }}
https://github.com/python/cpython/pull/156781/files#diff-e21153994554acf95a199315fd29ba309c56809976a9329b934a0b920633f923
https://github.com/python/cpython/pull/156781/files#diff-e21153994554acf95a199315fd29ba309c56809976a9329b934a0b920633f923
https://github.com/python/cpython/pull/156781/files#diff-e21153994554acf95a199315fd29ba309c56809976a9329b934a0b920633f923
https://github.com/python/cpython/pull/156781/files#diff-e21153994554acf95a199315fd29ba309c56809976a9329b934a0b920633f923
https://github.com/python/cpython/pull/156781/files#diff-e21153994554acf95a199315fd29ba309c56809976a9329b934a0b920633f923
https://github.com/python/cpython/pull/156781/files#diff-e21153994554acf95a199315fd29ba309c56809976a9329b934a0b920633f923
https://github.com/python/cpython/pull/156781/files#diff-e21153994554acf95a199315fd29ba309c56809976a9329b934a0b920633f923
https://github.com/python/cpython/blob/main/.github/CODEOWNERS#L84
configurehttps://github.com/python/cpython/pull/156781/files#diff-90d08e583c4c9c6f391b2ae90f819f600a6326928ea9512c9e0c6d98e9f29ac2
View file https://github.com/clementperon/cpython/blob/139c1e2150ded3deaa2176f2af3459e4974337a2/configure
Open in desktop https://desktop.github.com
how customized files appear on GitHubhttps://docs.github.com/github/administering-a-repository/customizing-how-changed-files-appear-on-github
Please reload this pagehttps://github.com/python/cpython/pull/156781/files
https://github.com/python/cpython/blob/main/.github/CODEOWNERS#L84
configure.achttps://github.com/python/cpython/pull/156781/files#diff-49473dca262eeab3b4a43002adb08b4db31020d190caaad1594b47f1d5daa810
View file https://github.com/clementperon/cpython/blob/139c1e2150ded3deaa2176f2af3459e4974337a2/configure.ac
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/156781/{{ revealButtonHref }}
https://github.com/python/cpython/pull/156781/files#diff-49473dca262eeab3b4a43002adb08b4db31020d190caaad1594b47f1d5daa810
https://github.com/python/cpython/pull/156781/files#diff-49473dca262eeab3b4a43002adb08b4db31020d190caaad1594b47f1d5daa810
Please reload this pagehttps://github.com/python/cpython/pull/156781/files
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.