René's URL Explorer Experiment


Title: gh-158973: Reset the warnings lock after fork in the child by nascheme · Pull Request #158974 · python/cpython · GitHub

Open Graph Title: gh-158973: Reset the warnings lock after fork in the child by nascheme · Pull Request #158974 · python/cpython

X Title: gh-158973: Reset the warnings lock after fork in the child by nascheme · Pull Request #158974 · python/cpython

Description: Reset the warnings lock in the child after fork, before clearing other threads’ states. This prevents deadlocks when their finalizers issue warnings and the lock was held by a thread that no longer exists. Record ownership before fork so the child can preserve the lock’s recursion depth and update its owner ID if the forking thread held it. Adds regression tests for child-cleanup warnings and recursive ownership across fork. The PR was developed with assistance from GPT 6.1 Sol. Issue: gh-158973

Open Graph Description: Reset the warnings lock in the child after fork, before clearing other threads’ states. This prevents deadlocks when their finalizers issue warnings and the lock was held by a thread that no longer...

X Description: Reset the warnings lock in the child after fork, before clearing other threads’ states. This prevents deadlocks when their finalizers issue warnings and the lock was held by a thread that no longer...

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

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:f5315a96-2e6d-41f6-d2ed-6a24ea53933f
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idD05E:28A483:1B25B01:23D6F1A:6B021E49
html-safe-nonce9efcea140cc172a7d01fecdc275701721daab4e88db796a6f9d0685d36f94ef0
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEMDVFOjI4QTQ4MzoxQjI1QjAxOjIzRDZGMUE6NkIwMjFFNDkiLCJ2aXNpdG9yX2lkIjoiODM3MTA1OTU1NDY3NTY2NjY1IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmace51e269facdc35de7cd54f2abdf8e8e6122efc44f258ab041fd74d031a071a2b
hovercard-subject-tagpull_request:4775898349
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/158974/files
twitter:imagehttps://avatars.githubusercontent.com/u/690853?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/690853?s=400&v=4
og:image:altReset the warnings lock in the child after fork, before clearing other threads’ states. This prevents deadlocks when their finalizers issue warnings and the lock was held by a thread that no longer...
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/158974/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fpull%2F158974%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%2F158974%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/158974/files
Reloadhttps://github.com/python/cpython/pull/158974/files
Reloadhttps://github.com/python/cpython/pull/158974/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
naschemehttps://github.com/nascheme
python:mainhttps://github.com/python/cpython/tree/main
nascheme:gh-158973-reset-warnings-lockhttps://github.com/nascheme/cpython/tree/gh-158973-reset-warnings-lock
Conversation 8 https://github.com/python/cpython/pull/158974
Commits 3 https://github.com/python/cpython/pull/158974/commits
Checks 63 https://github.com/python/cpython/pull/158974/checks
Files changed https://github.com/python/cpython/pull/158974/files
Please reload this pagehttps://github.com/python/cpython/pull/158974/files
gh-158973: Reset the warnings lock after fork in the child https://github.com/python/cpython/pull/158974/files#top
Show all changes 3 commits https://github.com/python/cpython/pull/158974/files
63ad59b gh-158973: Reset the warnings lock after fork in the child nascheme Oct 7, 2026 https://github.com/python/cpython/pull/158974/commits/63ad59bb3a33d4a39db9002cb6eb4c014a98fb13
2f7a64c Add helper function. nascheme Oct 7, 2026 https://github.com/python/cpython/pull/158974/commits/2f7a64ce96f7183c5550ecc32a105d91ef122a61
95ce674 Merge remote-tracking branch 'origin/main' into gh-158973-reset-warni… nascheme Oct 7, 2026 https://github.com/python/cpython/pull/158974/commits/95ce6748e74ff083deca047ce7195e2f3645741b
Clear filters https://github.com/python/cpython/pull/158974/files
Please reload this pagehttps://github.com/python/cpython/pull/158974/files
Please reload this pagehttps://github.com/python/cpython/pull/158974/files
pycore_interp_structs.h https://github.com/python/cpython/pull/158974/files#diff-6075b6142803c1eccc213aa150704fd639443c65311d5999f69a5ea77cb76756
pycore_lock.h https://github.com/python/cpython/pull/158974/files#diff-c4ea3ba1b986b7045be6c6260113e2b765c497ec9842e5c6c30abe466d1f2c73
pycore_warnings.h https://github.com/python/cpython/pull/158974/files#diff-4aacd6399c9c463b24a64311fb5b80b3666304d99b1224422074e66046bcaa3e
__init__.py https://github.com/python/cpython/pull/158974/files#diff-21be9e4809f5cd7dcd4665eb0054b4bf9d924c2c9ce0a010e85dba405e94d9e9
2026-10-07-00-00-00.gh-issue-158973.warnings-fork.rst https://github.com/python/cpython/pull/158974/files#diff-260ae62f7f6bb730407422c0bdea85e0986d681dc17df8d3e662ecddbdeceab0
posixmodule.c https://github.com/python/cpython/pull/158974/files#diff-b5b7e4f5599916b2018e911ef423f9d3fd46cb71268e1a73c74a1c9ae2cb6791
_warnings.c https://github.com/python/cpython/pull/158974/files#diff-868cb9c3ec7f49459c652319e480e03ee132976b45fbedacb94958f8e0a9ea58
lock.c https://github.com/python/cpython/pull/158974/files#diff-8a628e2db62193e1be26995ded4a1da56d11a156b4e9190984c910f1b019a962
Include/internal/pycore_interp_structs.hhttps://github.com/python/cpython/pull/158974/files#diff-6075b6142803c1eccc213aa150704fd639443c65311d5999f69a5ea77cb76756
View file https://github.com/nascheme/cpython/blob/95ce6748e74ff083deca047ce7195e2f3645741b/Include/internal/pycore_interp_structs.h
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/158974/{{ revealButtonHref }}
https://github.com/python/cpython/pull/158974/files#diff-6075b6142803c1eccc213aa150704fd639443c65311d5999f69a5ea77cb76756
https://github.com/python/cpython/pull/158974/files#diff-6075b6142803c1eccc213aa150704fd639443c65311d5999f69a5ea77cb76756
Include/internal/pycore_lock.hhttps://github.com/python/cpython/pull/158974/files#diff-c4ea3ba1b986b7045be6c6260113e2b765c497ec9842e5c6c30abe466d1f2c73
View file https://github.com/nascheme/cpython/blob/95ce6748e74ff083deca047ce7195e2f3645741b/Include/internal/pycore_lock.h
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/158974/{{ revealButtonHref }}
https://github.com/python/cpython/pull/158974/files#diff-c4ea3ba1b986b7045be6c6260113e2b765c497ec9842e5c6c30abe466d1f2c73
https://github.com/python/cpython/pull/158974/files#diff-c4ea3ba1b986b7045be6c6260113e2b765c497ec9842e5c6c30abe466d1f2c73
Include/internal/pycore_warnings.hhttps://github.com/python/cpython/pull/158974/files#diff-4aacd6399c9c463b24a64311fb5b80b3666304d99b1224422074e66046bcaa3e
View file https://github.com/nascheme/cpython/blob/95ce6748e74ff083deca047ce7195e2f3645741b/Include/internal/pycore_warnings.h
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/158974/{{ revealButtonHref }}
https://github.com/python/cpython/pull/158974/files#diff-4aacd6399c9c463b24a64311fb5b80b3666304d99b1224422074e66046bcaa3e
https://github.com/python/cpython/pull/158974/files#diff-4aacd6399c9c463b24a64311fb5b80b3666304d99b1224422074e66046bcaa3e
Lib/test/test_warnings/__init__.pyhttps://github.com/python/cpython/pull/158974/files#diff-21be9e4809f5cd7dcd4665eb0054b4bf9d924c2c9ce0a010e85dba405e94d9e9
View file https://github.com/nascheme/cpython/blob/95ce6748e74ff083deca047ce7195e2f3645741b/Lib/test/test_warnings/__init__.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/158974/{{ revealButtonHref }}
https://github.com/python/cpython/pull/158974/files#diff-21be9e4809f5cd7dcd4665eb0054b4bf9d924c2c9ce0a010e85dba405e94d9e9
https://github.com/python/cpython/pull/158974/files#diff-21be9e4809f5cd7dcd4665eb0054b4bf9d924c2c9ce0a010e85dba405e94d9e9
https://github.com/python/cpython/pull/158974/files#diff-21be9e4809f5cd7dcd4665eb0054b4bf9d924c2c9ce0a010e85dba405e94d9e9
https://github.com/python/cpython/pull/158974/files#diff-21be9e4809f5cd7dcd4665eb0054b4bf9d924c2c9ce0a010e85dba405e94d9e9
....d/next/Core_and_Builtins/2026-10-07-00-00-00.gh-issue-158973.warnings-fork.rsthttps://github.com/python/cpython/pull/158974/files#diff-260ae62f7f6bb730407422c0bdea85e0986d681dc17df8d3e662ecddbdeceab0
View file https://github.com/nascheme/cpython/blob/95ce6748e74ff083deca047ce7195e2f3645741b/Misc/NEWS.d/next/Core_and_Builtins/2026-10-07-00-00-00.gh-issue-158973.warnings-fork.rst
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/158974/{{ revealButtonHref }}
Modules/posixmodule.chttps://github.com/python/cpython/pull/158974/files#diff-b5b7e4f5599916b2018e911ef423f9d3fd46cb71268e1a73c74a1c9ae2cb6791
View file https://github.com/nascheme/cpython/blob/95ce6748e74ff083deca047ce7195e2f3645741b/Modules/posixmodule.c
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/158974/{{ revealButtonHref }}
https://github.com/python/cpython/pull/158974/files#diff-b5b7e4f5599916b2018e911ef423f9d3fd46cb71268e1a73c74a1c9ae2cb6791
https://github.com/python/cpython/pull/158974/files#diff-b5b7e4f5599916b2018e911ef423f9d3fd46cb71268e1a73c74a1c9ae2cb6791
https://github.com/python/cpython/pull/158974/files#diff-b5b7e4f5599916b2018e911ef423f9d3fd46cb71268e1a73c74a1c9ae2cb6791
https://github.com/python/cpython/pull/158974/files#diff-b5b7e4f5599916b2018e911ef423f9d3fd46cb71268e1a73c74a1c9ae2cb6791
https://github.com/python/cpython/pull/158974/files#diff-b5b7e4f5599916b2018e911ef423f9d3fd46cb71268e1a73c74a1c9ae2cb6791
https://github.com/python/cpython/pull/158974/files#diff-b5b7e4f5599916b2018e911ef423f9d3fd46cb71268e1a73c74a1c9ae2cb6791
Python/_warnings.chttps://github.com/python/cpython/pull/158974/files#diff-868cb9c3ec7f49459c652319e480e03ee132976b45fbedacb94958f8e0a9ea58
View file https://github.com/nascheme/cpython/blob/95ce6748e74ff083deca047ce7195e2f3645741b/Python/_warnings.c
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/158974/{{ revealButtonHref }}
https://github.com/python/cpython/pull/158974/files#diff-868cb9c3ec7f49459c652319e480e03ee132976b45fbedacb94958f8e0a9ea58
https://github.com/python/cpython/pull/158974/files#diff-868cb9c3ec7f49459c652319e480e03ee132976b45fbedacb94958f8e0a9ea58
https://github.com/python/cpython/pull/158974/files#diff-868cb9c3ec7f49459c652319e480e03ee132976b45fbedacb94958f8e0a9ea58
https://github.com/python/cpython/pull/158974/files#diff-868cb9c3ec7f49459c652319e480e03ee132976b45fbedacb94958f8e0a9ea58
Python/lock.chttps://github.com/python/cpython/pull/158974/files#diff-8a628e2db62193e1be26995ded4a1da56d11a156b4e9190984c910f1b019a962
View file https://github.com/nascheme/cpython/blob/95ce6748e74ff083deca047ce7195e2f3645741b/Python/lock.c
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/158974/{{ revealButtonHref }}
https://github.com/python/cpython/pull/158974/files#diff-8a628e2db62193e1be26995ded4a1da56d11a156b4e9190984c910f1b019a962
https://github.com/python/cpython/pull/158974/files#diff-8a628e2db62193e1be26995ded4a1da56d11a156b4e9190984c910f1b019a962
Please reload this pagehttps://github.com/python/cpython/pull/158974/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.