René's URL Explorer Experiment


Title: Align shutdown flush and unraisable reporting with CPython by youknowone · Pull Request #9690 · RustPython/RustPython · GitHub

Open Graph Title: Align shutdown flush and unraisable reporting with CPython by youknowone · Pull Request #9690 · RustPython/RustPython

X Title: Align shutdown flush and unraisable reporting with CPython by youknowone · Pull Request #9690 · RustPython/RustPython

Description: Summary Align shutdown stream failures and unraisable exception reporting with CPython 3.15, using one shared fallible writer instead of separate default-hook and VM fallback implementations. Retain the selected stderr object through callbacks, preserve Python strings, and use the existing traceback formatter with that explicit file. Keep a native fallback when the formatter is unavailable, including CPython's repr/str failure handling. Read standard streams and the unraisable hook directly from the sys dictionary. Preserve audit ordering and invoke an available user hook during finalization. Flush after exit callbacks and before module cleanup. Report stdout failures with the shutdown-specific message, count stderr failures without reporting through the broken stream, and return status 120 for either stream failure even after a nonzero requested exit status. The remaining test_cmd_line.test_stdout_flush_at_shutdown expected failure motivates this group. Its marker is unchanged; this PR does not claim the test passes or full shutdown parity. No Lib files or tests are edited, and no thread, GC, or signal algorithm is replaced. Reference Compared against CPython 3.15 commit d220409a13b77de7a6c30abe16ea90db01528edc: Default unraisable writer and hook dispatch Shutdown stream error handling Finalization flush order Validation Independent source review, rustfmt, and git diff --check passed. cargo clippy --locked --offline -p rustpython-vm --all-targets --features threading -- -D warnings passed. cargo clippy --locked --offline -p rustpython-vm --all-targets passed with the existing no-thread Arc warning at _ctypes/base.rs:2246. Normal commit hooks passed. RustPython execution, runtime tests, and workspace-wide tests have not been run because the runtime safety guard has not been verified. This remains a draft for guarded runtime validation, including shutdown failures, hook callbacks, traceback import failure, and broken/custom streams. AI assistance: OpenAI Codex (dot) assisted with implementation, CPython source comparison, and review. Model version is not exposed. Validation limits are stated above. Summary by CodeRabbit Bug Fixes Improved reporting of ignored exceptions, including when customized error output or formatting fails. Improved shutdown handling of output streams: flush failures are reported more consistently and can affect the process exit status. Added safeguards for streams locked by another thread during shutdown, including a diagnostic before termination. Repeated calls to input() now preserve buffered input across threaded input and stream changes; reentrant calls return an error rather than opening another reader.

Open Graph Description: Summary Align shutdown stream failures and unraisable exception reporting with CPython 3.15, using one shared fallible writer instead of separate default-hook and VM fallback implementations. Reta...

X Description: Summary Align shutdown stream failures and unraisable exception reporting with CPython 3.15, using one shared fallible writer instead of separate default-hook and VM fallback implementations. Reta...

Opengraph URL: https://github.com/RustPython/RustPython/pull/9690

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:d80bb1e1-9739-70ab-6000-9cf5a24e9ea9
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idB66E:14EB6E:16BBB84:1DE7D32:6B01FE54
html-safe-nonce7c29a6a3406ec3a81624a0b7383d85a9014d74c2bc4a2a52f08007aa2f4d5d1c
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCNjZFOjE0RUI2RToxNkJCQjg0OjFERTdEMzI6NkIwMUZFNTQiLCJ2aXNpdG9yX2lkIjoiMTU3NDY3Nzc4NTgxMTc0NjM4OCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac19b7839c26c0b9d6d3d3b2624c29e3c8de1b7bdbd8f3422d71724185d9506bd0
hovercard-subject-tagpull_request:5148959661
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/RustPython/RustPython/pull/9690/files
twitter:imagehttps://avatars.githubusercontent.com/u/69878?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/69878?s=400&v=4
og:image:altSummary Align shutdown stream failures and unraisable exception reporting with CPython 3.15, using one shared fallible writer instead of separate default-hook and VM fallback implementations. Reta...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/RustPython/RustPython git https://github.com/RustPython/RustPython.git
octolytics-dimension-user_id39710557
octolytics-dimension-user_loginRustPython
octolytics-dimension-repository_id135201145
octolytics-dimension-repository_nwoRustPython/RustPython
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id135201145
octolytics-dimension-repository_network_root_nwoRustPython/RustPython
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/RustPython/RustPython/pull/9690/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FRustPython%2FRustPython%2Fpull%2F9690%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%2FRustPython%2FRustPython%2Fpull%2F9690%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=RustPython%2FRustPython
Reloadhttps://github.com/RustPython/RustPython/pull/9690/files
Reloadhttps://github.com/RustPython/RustPython/pull/9690/files
Reloadhttps://github.com/RustPython/RustPython/pull/9690/files
RustPythonhttps://github.com/RustPython
RustPythonhttps://github.com/RustPython/RustPython
Codehttps://github.com/RustPython/RustPython
Issues195 (195)https://github.com/RustPython/RustPython/issues
Pull requests133 (133)https://github.com/RustPython/RustPython/pulls
Discussionshttps://github.com/RustPython/RustPython/discussions
Actionshttps://github.com/RustPython/RustPython/actions
Projectshttps://github.com/RustPython/RustPython/projects
Wikihttps://github.com/RustPython/RustPython/wiki
Security and qualityhttps://github.com/RustPython/RustPython/security
Insightshttps://github.com/RustPython/RustPython/insights
Sign up for GitHub https://github.com/signup?return_to=%2FRustPython%2FRustPython%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2FRustPython%2FRustPython%2Fissues%2Fnew%2Fchoose
youknowonehttps://github.com/youknowone
RustPython:mainhttps://github.com/RustPython/RustPython/tree/main
youknowdot:shutdown-unraisable-reporting-20261104https://github.com/youknowdot/RustPython/tree/shutdown-unraisable-reporting-20261104
Conversation 13 https://github.com/RustPython/RustPython/pull/9690
Commits 8 https://github.com/RustPython/RustPython/pull/9690/commits
Checks 28 https://github.com/RustPython/RustPython/pull/9690/checks
Files changed https://github.com/RustPython/RustPython/pull/9690/files
Please reload this pagehttps://github.com/RustPython/RustPython/pull/9690/files
Align shutdown flush and unraisable reporting with CPython https://github.com/RustPython/RustPython/pull/9690/files#top
Show all changes 8 commits https://github.com/RustPython/RustPython/pull/9690/files
a689d40 Align shutdown flush and unraisable reporting with CPython youknowdot Nov 4, 2026 https://github.com/RustPython/RustPython/pull/9690/commits/a689d402dbec09d4735b0d5d67fa58b53bc9939a
dac78d5 Fix shutdown CI locks and preserve input read-ahead youknowdot Nov 5, 2026 https://github.com/RustPython/RustPython/pull/9690/commits/dac78d550dd9a520b7a6a943f268c88dcac469c6
d9c893a Adapt unraisable fallback to current traceback writer codex Nov 7, 2026 https://github.com/RustPython/RustPython/pull/9690/commits/d9c893ab0c8af405508009bfbfbab56734cd57e3
d00b458 Use core RefCell for retained input reader codex Nov 7, 2026 https://github.com/RustPython/RustPython/pull/9690/commits/d00b4581c4483e062e23560179a67a6012a9aa00
1e6cf20 Mark timed mutex tests with explicit test cfg codex Nov 7, 2026 https://github.com/RustPython/RustPython/pull/9690/commits/1e6cf203341c89f5ad1c2a336d9c5d6c8078515d
a093255 Share interactive input read-ahead across threads codex Nov 7, 2026 https://github.com/RustPython/RustPython/pull/9690/commits/a093255e6b7d5f0fcb0a25cfc471f72b5f0a5758
d3049db Exercise input from the result audit hook codex Nov 7, 2026 https://github.com/RustPython/RustPython/pull/9690/commits/d3049db5a471ebf4a968cbbe86ade7fbac124900
16db304 Drain both terminals while testing input redirection codex Nov 8, 2026 https://github.com/RustPython/RustPython/pull/9690/commits/16db30436aab907eb2417f14fc145fa115c06594
Clear filters https://github.com/RustPython/RustPython/pull/9690/files
Please reload this pagehttps://github.com/RustPython/RustPython/pull/9690/files
Please reload this pagehttps://github.com/RustPython/RustPython/pull/9690/files
test_cmd_line.py https://github.com/RustPython/RustPython/pull/9690/files#diff-128fff16ea63b541718887f5c714e0c1a357414fe1146b4893ef699e8853e3b0
thread_mutex.rs https://github.com/RustPython/RustPython/pull/9690/files#diff-037464c3c77d981a319a904278e36a8c9ee055ee4496400260052e725be0579b
readline.rs https://github.com/RustPython/RustPython/pull/9690/files#diff-96460472d349df3dc6f7eff5fb7c7cc5222399575726eb4e78c8d1e9e963acaf
exceptions.rs https://github.com/RustPython/RustPython/pull/9690/files#diff-f527bc3e68302079a32d6da36816531e3e22dd31ff91ef0ff0f2688673712747
_io.rs https://github.com/RustPython/RustPython/pull/9690/files#diff-90825edc73ec293e0ed3b2dbed7f0a492b1f8e51c25747326089a912267bdd3e
builtins.rs https://github.com/RustPython/RustPython/pull/9690/files#diff-ce8bd80bb61ce870dbf04415913693df814ebda260d3fc784b689a657e694ca3
sys.rs https://github.com/RustPython/RustPython/pull/9690/files#diff-e7f7c10b81f88d7af77af76257284e18e72ed9da63ff63675a9e9cb31c8d262d
interpreter.rs https://github.com/RustPython/RustPython/pull/9690/files#diff-2361f366cc46771907dbd3b09eb8b9c839e7f059710345f2265c1753862a1b20
mod.rs https://github.com/RustPython/RustPython/pull/9690/files#diff-fe30ecf7c6b462e46e0874a55a05ea0edba83cefad5ac7a86e7137fa8f86ba74
vm_object.rs https://github.com/RustPython/RustPython/pull/9690/files#diff-8d455749c67df5f6030ce84784d39256f31f0bec713e953d171a27fd300d1d27
stdlib_input_readline.py https://github.com/RustPython/RustPython/pull/9690/files#diff-abdb2e67e5d52e656c33dc926f5130084a2fedbf560ef6251604ffce79449b8a
Lib/test/test_cmd_line.pyhttps://github.com/RustPython/RustPython/pull/9690/files#diff-128fff16ea63b541718887f5c714e0c1a357414fe1146b4893ef699e8853e3b0
View file https://github.com/youknowdot/RustPython/blob/16db30436aab907eb2417f14fc145fa115c06594/Lib/test/test_cmd_line.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/RustPython/RustPython/pull/9690/{{ revealButtonHref }}
https://github.com/RustPython/RustPython/pull/9690/files#diff-128fff16ea63b541718887f5c714e0c1a357414fe1146b4893ef699e8853e3b0
https://github.com/RustPython/RustPython/pull/9690/files#diff-128fff16ea63b541718887f5c714e0c1a357414fe1146b4893ef699e8853e3b0
crates/common/src/lock/thread_mutex.rshttps://github.com/RustPython/RustPython/pull/9690/files#diff-037464c3c77d981a319a904278e36a8c9ee055ee4496400260052e725be0579b
View file https://github.com/youknowdot/RustPython/blob/16db30436aab907eb2417f14fc145fa115c06594/crates/common/src/lock/thread_mutex.rs
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/RustPython/RustPython/pull/9690/{{ revealButtonHref }}
https://github.com/RustPython/RustPython/pull/9690/files#diff-037464c3c77d981a319a904278e36a8c9ee055ee4496400260052e725be0579b
https://github.com/RustPython/RustPython/pull/9690/files#diff-037464c3c77d981a319a904278e36a8c9ee055ee4496400260052e725be0579b
https://github.com/RustPython/RustPython/pull/9690/files#diff-037464c3c77d981a319a904278e36a8c9ee055ee4496400260052e725be0579b
https://github.com/RustPython/RustPython/pull/9690/files#diff-037464c3c77d981a319a904278e36a8c9ee055ee4496400260052e725be0579b
https://github.com/RustPython/RustPython/pull/9690/files#diff-037464c3c77d981a319a904278e36a8c9ee055ee4496400260052e725be0579b
crates/host_env/src/readline.rshttps://github.com/RustPython/RustPython/pull/9690/files#diff-96460472d349df3dc6f7eff5fb7c7cc5222399575726eb4e78c8d1e9e963acaf
View file https://github.com/youknowdot/RustPython/blob/16db30436aab907eb2417f14fc145fa115c06594/crates/host_env/src/readline.rs
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/RustPython/RustPython/pull/9690/{{ revealButtonHref }}
https://github.com/RustPython/RustPython/pull/9690/files#diff-96460472d349df3dc6f7eff5fb7c7cc5222399575726eb4e78c8d1e9e963acaf
https://github.com/RustPython/RustPython/pull/9690/files#diff-96460472d349df3dc6f7eff5fb7c7cc5222399575726eb4e78c8d1e9e963acaf
https://github.com/RustPython/RustPython/pull/9690/files#diff-96460472d349df3dc6f7eff5fb7c7cc5222399575726eb4e78c8d1e9e963acaf
https://github.com/RustPython/RustPython/pull/9690/files#diff-96460472d349df3dc6f7eff5fb7c7cc5222399575726eb4e78c8d1e9e963acaf
crates/vm/src/exceptions.rshttps://github.com/RustPython/RustPython/pull/9690/files#diff-f527bc3e68302079a32d6da36816531e3e22dd31ff91ef0ff0f2688673712747
View file https://github.com/youknowdot/RustPython/blob/16db30436aab907eb2417f14fc145fa115c06594/crates/vm/src/exceptions.rs
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/RustPython/RustPython/pull/9690/{{ revealButtonHref }}
https://github.com/RustPython/RustPython/pull/9690/files#diff-f527bc3e68302079a32d6da36816531e3e22dd31ff91ef0ff0f2688673712747
https://github.com/RustPython/RustPython/pull/9690/files#diff-f527bc3e68302079a32d6da36816531e3e22dd31ff91ef0ff0f2688673712747
https://github.com/RustPython/RustPython/pull/9690/files#diff-f527bc3e68302079a32d6da36816531e3e22dd31ff91ef0ff0f2688673712747
crates/vm/src/stdlib/_io.rshttps://github.com/RustPython/RustPython/pull/9690/files#diff-90825edc73ec293e0ed3b2dbed7f0a492b1f8e51c25747326089a912267bdd3e
View file https://github.com/youknowdot/RustPython/blob/16db30436aab907eb2417f14fc145fa115c06594/crates/vm/src/stdlib/_io.rs
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/RustPython/RustPython/pull/9690/{{ revealButtonHref }}
https://github.com/RustPython/RustPython/pull/9690/files#diff-90825edc73ec293e0ed3b2dbed7f0a492b1f8e51c25747326089a912267bdd3e
coderabbitaihttps://github.com/apps/coderabbitai
Nov 5, 2026https://github.com/RustPython/RustPython/pull/9690/files#r4476036859
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
Please reload this pagehttps://github.com/RustPython/RustPython/pull/9690/files
https://github.com/RustPython/RustPython/pull/9690/files#diff-90825edc73ec293e0ed3b2dbed7f0a492b1f8e51c25747326089a912267bdd3e
https://github.com/RustPython/RustPython/pull/9690/files#diff-90825edc73ec293e0ed3b2dbed7f0a492b1f8e51c25747326089a912267bdd3e
https://github.com/RustPython/RustPython/pull/9690/files#diff-90825edc73ec293e0ed3b2dbed7f0a492b1f8e51c25747326089a912267bdd3e
https://github.com/RustPython/RustPython/pull/9690/files#diff-90825edc73ec293e0ed3b2dbed7f0a492b1f8e51c25747326089a912267bdd3e
crates/vm/src/stdlib/builtins.rshttps://github.com/RustPython/RustPython/pull/9690/files#diff-ce8bd80bb61ce870dbf04415913693df814ebda260d3fc784b689a657e694ca3
View file https://github.com/youknowdot/RustPython/blob/16db30436aab907eb2417f14fc145fa115c06594/crates/vm/src/stdlib/builtins.rs
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/RustPython/RustPython/pull/9690/{{ revealButtonHref }}
https://github.com/RustPython/RustPython/pull/9690/files#diff-ce8bd80bb61ce870dbf04415913693df814ebda260d3fc784b689a657e694ca3
https://github.com/RustPython/RustPython/pull/9690/files#diff-ce8bd80bb61ce870dbf04415913693df814ebda260d3fc784b689a657e694ca3
https://github.com/RustPython/RustPython/pull/9690/files#diff-ce8bd80bb61ce870dbf04415913693df814ebda260d3fc784b689a657e694ca3
https://github.com/RustPython/RustPython/pull/9690/files#diff-ce8bd80bb61ce870dbf04415913693df814ebda260d3fc784b689a657e694ca3
Please reload this pagehttps://github.com/RustPython/RustPython/pull/9690/files
Please reload this pagehttps://github.com/RustPython/RustPython/pull/9690/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.