René's URL Explorer Experiment


Title: Py_Main and Py_RunMain SystemExit documentation does not match actual behavior · Issue #133264 · python/cpython · GitHub

Open Graph Title: Py_Main and Py_RunMain SystemExit documentation does not match actual behavior · Issue #133264 · python/cpython

X Title: Py_Main and Py_RunMain SystemExit documentation does not match actual behavior · Issue #133264 · python/cpython

Description: A few months ago, #8023 added some details to the docs about how Py_RunMain determines its exit status. Specifically, it wrote thatPy_RunMain exits the process on an unhandled SystemExit. But this isn't the case, at least not when runnin...

Open Graph Description: A few months ago, #8023 added some details to the docs about how Py_RunMain determines its exit status. Specifically, it wrote thatPy_RunMain exits the process on an unhandled SystemExit. But this ...

X Description: A few months ago, #8023 added some details to the docs about how Py_RunMain determines its exit status. Specifically, it wrote thatPy_RunMain exits the process on an unhandled SystemExit. But this ...

Opengraph URL: https://github.com/python/cpython/issues/133264

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Py_Main and Py_RunMain SystemExit documentation does not match actual behavior","articleBody":"A few months ago, #8023 added some details to the docs about how `Py_RunMain` determines its exit status. Specifically, it wrote that`Py_RunMain` exits the process on an unhandled `SystemExit`. \n\nBut this isn't the case, at least not when running via the `pymain_run_module` path (the other paths aren't so clear to me). The relevant code is in `pymain_err_print`, which specifically checks for `SystemExit` in order to avoid passing it to `PyErr_Print`, which is where `exit` would actually be called.\n\nMy understanding is that `Py_RunMain` was intended for an embedded context, in which case exiting the process is probably not desirable. \n\nThe docs of `Py_Main` have specified the process exiting behavior for much longer, but right now it looks like both functions share the same implementation.\n\n@vstinner @ncoghlan \n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-135337\n* gh-135394\n* gh-135395\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/mhsmith","@type":"Person","name":"mhsmith"},"datePublished":"2025-05-01T16:22:02.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":10},"url":"https://github.com/133264/cpython/issues/133264"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:84375cc7-8aed-3ed2-56e4-98901c853207
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idD300:1EC7:51AEB50:73F63D6:6A500D28
html-safe-nonce24302bd4e909cf5de4666ee82de5973d78be8f2396a433d7f926b66272af98df
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEMzAwOjFFQzc6NTFBRUI1MDo3M0Y2M0Q2OjZBNTAwRDI4IiwidmlzaXRvcl9pZCI6IjE0NTUyMDQ4Mzk0NDEwNDI3MjgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac20b070fb607ddcaee58ccf0779aea2d7cd116ec22e28d0ab16c2fe38c7994e60
hovercard-subject-tagissue:3034203796
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/133264/issue_layout
twitter:imagehttps://opengraph.githubassets.com/1139f6e099f1c32cb3563959a04e7d8fc47fe555ea78e588194757a6a1da4639/python/cpython/issues/133264
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/1139f6e099f1c32cb3563959a04e7d8fc47fe555ea78e588194757a6a1da4639/python/cpython/issues/133264
og:image:altA few months ago, #8023 added some details to the docs about how Py_RunMain determines its exit status. Specifically, it wrote thatPy_RunMain exits the process on an unhandled SystemExit. But this ...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamemhsmith
hostnamegithub.com
expected-hostnamegithub.com
None56eec25a3430492dd6ec2a480eb33256a0da5192d5714b0db4f5ab5f33203d94
turbo-cache-controlno-preview
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
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release93a615b89b7dcbdb6b678f4772931ecc28ada82a
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/python/cpython/issues/133264#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fissues%2F133264
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fissues%2F133264
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=python%2Fcpython
Reloadhttps://github.com/python/cpython/issues/133264
Reloadhttps://github.com/python/cpython/issues/133264
Reloadhttps://github.com/python/cpython/issues/133264
Please reload this pagehttps://github.com/python/cpython/issues/133264
python https://github.com/python
cpythonhttps://github.com/python/cpython
Please reload this pagehttps://github.com/python/cpython/issues/133264
Notifications https://github.com/login?return_to=%2Fpython%2Fcpython
Fork 34.9k https://github.com/login?return_to=%2Fpython%2Fcpython
Star 73.6k https://github.com/login?return_to=%2Fpython%2Fcpython
Code https://github.com/python/cpython
Issues 5k+ https://github.com/python/cpython/issues
Pull requests 2.3k https://github.com/python/cpython/pulls
Actions https://github.com/python/cpython/actions
Projects https://github.com/python/cpython/projects
Security and quality 0 https://github.com/python/cpython/security
Insights https://github.com/python/cpython/pulse
Code https://github.com/python/cpython
Issues https://github.com/python/cpython/issues
Pull requests https://github.com/python/cpython/pulls
Actions https://github.com/python/cpython/actions
Projects https://github.com/python/cpython/projects
Security and quality https://github.com/python/cpython/security
Insights https://github.com/python/cpython/pulse
Py_Main and Py_RunMain SystemExit documentation does not match actual behaviorhttps://github.com/python/cpython/issues/133264#top
docsDocumentation in the Doc dirhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22docs%22
topic-C-APIhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22topic-C-API%22
https://github.com/mhsmith
mhsmithhttps://github.com/mhsmith
on May 1, 2025https://github.com/python/cpython/issues/133264#issue-3034203796
#8023https://github.com/python/cpython/pull/8023
@vstinnerhttps://github.com/vstinner
@ncoghlanhttps://github.com/ncoghlan
gh-133264: Correct documentation of how Py_Main and Py_RunMain handle SystemExit #135337https://github.com/python/cpython/pull/135337
[3.14] gh-133264: Correct documentation of how Py_Main and Py_RunMain handle SystemExit (GH-135337) #135394https://github.com/python/cpython/pull/135394
[3.13] gh-133264: Correct documentation of how Py_Main and Py_RunMain handle SystemExit (GH-135337) #135395https://github.com/python/cpython/pull/135395
docsDocumentation in the Doc dirhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22docs%22
topic-C-APIhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22topic-C-API%22
docs issueshttps://github.com/orgs/python/projects/52
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.