René's URL Explorer Experiment


Title: gh-153711: Guard dup3/pipe2 with __builtin_available on Apple platforms by Vamsi-klu · Pull Request #154718 · python/cpython · GitHub

Open Graph Title: gh-153711: Guard dup3/pipe2 with __builtin_available on Apple platforms by Vamsi-klu · Pull Request #154718 · python/cpython

X Title: gh-153711: Guard dup3/pipe2 with __builtin_available on Apple platforms by Vamsi-klu · Pull Request #154718 · python/cpython

Description: Summary Fix gh-153711 (deferred-blocker): when CPython is built with an Xcode 27 SDK, dup3 / pipe2 are detected at configure time but only exist at runtime on macOS / iOS 27+. On older OSes they bind as weak_import NULL and the first os.pipe() / non-inheritable os.dup2() jumps to address 0. What the issue is Xcode 27 SDKs annotate dup3/pipe2 with __API_AVAILABLE(macos(27.0), iOS(27.0), …). AC_CHECK_FUNCS synthesizes its own char dup3(); prototype, ignores availability, links against libSystem.tbd, and defines HAVE_DUP3 / HAVE_PIPE2. Modules/posixmodule.c then calls them unconditionally inside os_dup2_impl / os_pipe_impl / os_pipe2_impl. With MACOSX_DEPLOYMENT_TARGET < 27, the symbols are weak; on macOS 26 they are NULL → EXC_BAD_ACCESS. os.pipe() is on the hot path of subprocess, multiprocessing, and asyncio — effectively a total-loss crash for python.org-style builds. iOS was already excluded from the configure check (gh-150443 / #150444). macOS was not. The issue body already points at the gh-97897 (mkfifoat/mknodat) weak-linking pattern. Why I solved it that way Runtime __builtin_available guards, not configure hacks — configure cannot see availability attributes, and we still want the symbols on macOS 27+. Reuse the existing three-arm HAVE_*_RUNTIME machinery in posixmodule.c (modern / Xcode≤8 / non-Apple) documented in Mac/README.rst. Omitting any arm breaks the build. Sole-expression if (HAVE_X_RUNTIME) — Apple's compiler rejects if (!HAVE_X_RUNTIME). Latch dup3_works = 0 when unavailable so the existing dup2+FD_CLOEXEC fallback runs this call and every later call without re-probing. Seed res = -1; errno = ENOSYS before the pipe2 probe so the existing ENOSYS → pipe() fallback still runs when the symbol is missing (uninitialized res/errno would be a footgun). Pop os.pipe2 from the module dict when unavailable (same idiom as pwritev/preadv) because os_pipe2_impl has no fallback and would crash on direct call. Existing tests already hasattr(os, "pipe2"). Omit visionOS from __builtin_available — no other macro in the block names it; pre-Xcode-15 clang rejects the spelling. Honest verification limit: this environment is Linux. Code mirrors gh-97897; an OS-mac core dev with Xcode 27 should confirm on macOS 26. How I did it Area Change Modules/posixmodule.c HAVE_DUP3_RUNTIME / HAVE_PIPE2_RUNTIME in all 3 arms; guard dup3/pipe2 call sites; pop pipe2 at exec Lib/test/test_os/test_posix.py TestPosixWeaklinking.test_pipe2 / test_dup3 Doc/library/os.rst os.pipe2 availability notes macOS/iOS ≥ 27 Misc/NEWS.d/next/macOS/ blurb for gh-153711 Impact Unblocks building with Xcode 27 SDKs while deploying to macOS < 27. On Linux/non-Apple, macros are 1 — zero codegen change (constant-folded). On macOS ≥ 27, behavior unchanged (fast path still used). Deferred-blocker across 3.13–3.16 — backports appropriate after OS-mac review. Testing plan Linux debug build + ./python -m test test_os.test_posix — PASS (weaklinking class skipped on non-macOS, as designed). Smoke: os.pipe() / os.dup2(..., inheritable=False) on Linux — OK. Needed from reviewer / buildbot: macOS 26 host, Xcode 27 SDK, deployment target < 27: Before: crash on os.pipe() / os.pipe2 / non-inheritable dup2. After: os.pipe() works via fallback; hasattr(os, "pipe2") is False; TestPosixWeaklinking assertions hold. macOS 27+ : pipe2 present, weaklinking tests assert attrs exist. CI: macOS jobs (will not fully exercise the Xcode 27 × older OS matrix). Everything else Does not undo iOS configure exclusion from #150444. Pattern credit: Ned Deily's gh-97897 / commit for mkfifoat/mknodat. Backports: 3.15, 3.14, 3.13 after merge. Reviewers: OS-mac / Apple platform SMEs. Requested reviewers (subject-matter experts) Could the following SMEs take a look when convenient (I cannot formally request reviews from this fork account): ned-deily — OS-mac / weak-linking (gh-97897 pattern) ronaldoussoren — macOS freakboy3742 — Apple/iOS (adjacent gh-150443) Thank you!

Open Graph Description: Summary Fix gh-153711 (deferred-blocker): when CPython is built with an Xcode 27 SDK, dup3 / pipe2 are detected at configure time but only exist at runtime on macOS / iOS 27+. On older OSes they bi...

X Description: Summary Fix gh-153711 (deferred-blocker): when CPython is built with an Xcode 27 SDK, dup3 / pipe2 are detected at configure time but only exist at runtime on macOS / iOS 27+. On older OSes they bi...

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

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:f5d7f546-c9f1-2194-bedf-7079085945c9
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-id843E:19299:1095F9:172089:6AFDADA5
html-safe-noncec299c0ff1e70b18bf30c3df34d2c8fdb7f619f77888e8192b57ea54c87e8e668
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4NDNFOjE5Mjk5OjEwOTVGOToxNzIwODk6NkFGREFEQTUiLCJ2aXNpdG9yX2lkIjoiODM1NDUzNTM3NzY5NTc4MDI2MSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac2cd9c9ee8673b7a3aa83b265ba770e83444f414fc2cbcf818187ae28fa8e82d5
hovercard-subject-tagpull_request:4135411285
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/154718/files
twitter:imagehttps://avatars.githubusercontent.com/u/32898216?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/32898216?s=400&v=4
og:image:altSummary Fix gh-153711 (deferred-blocker): when CPython is built with an Xcode 27 SDK, dup3 / pipe2 are detected at configure time but only exist at runtime on macOS / iOS 27+. On older OSes they bi...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
Nonebc86424ef34a73b386237872800e922d149d65ba907f63d6f150a2dcb8433bea
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
release0ddf53eb35c87f1f8df13dbf75c3bdadbfc6e969
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/python/cpython/pull/154718/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fpull%2F154718%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%2F154718%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/154718/files
Reloadhttps://github.com/python/cpython/pull/154718/files
Reloadhttps://github.com/python/cpython/pull/154718/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
Vamsi-kluhttps://github.com/Vamsi-klu
python:mainhttps://github.com/python/cpython/tree/main
Vamsi-klu:fix-gh153711-macos-dup3-pipe2-weaklinkhttps://github.com/Vamsi-klu/cpython/tree/fix-gh153711-macos-dup3-pipe2-weaklink
Conversation 8 https://github.com/python/cpython/pull/154718
Commits 2 https://github.com/python/cpython/pull/154718/commits
Checks 51 https://github.com/python/cpython/pull/154718/checks
Files changed https://github.com/python/cpython/pull/154718/files
Please reload this pagehttps://github.com/python/cpython/pull/154718/files
gh-153711: Guard dup3/pipe2 with __builtin_available on Apple platforms https://github.com/python/cpython/pull/154718/files#top
Show all changes 2 commits https://github.com/python/cpython/pull/154718/files
e5fbe3b gh-153711: Guard dup3/pipe2 with __builtin_available on Apple platforms Vamsi-klu Jul 26, 2026 https://github.com/python/cpython/pull/154718/commits/e5fbe3bb600fb57ab73168cc387e157a00b536e0
548b366 gh-153711: Fix os.pipe2 availability directive syntax Vamsi-klu Jul 26, 2026 https://github.com/python/cpython/pull/154718/commits/548b366f3bcaa1c151c027430d108f29463f24de
Clear filters https://github.com/python/cpython/pull/154718/files
Please reload this pagehttps://github.com/python/cpython/pull/154718/files
Please reload this pagehttps://github.com/python/cpython/pull/154718/files
os.rst https://github.com/python/cpython/pull/154718/files#diff-cd9132e5234678864807ae34a75c5d4d6b894b31c327a4d3620fbd0c37eec16e
test_posix.py https://github.com/python/cpython/pull/154718/files#diff-c2ffce99c501f7f4b6bde21947391671e95f592edcdf8bddbe4706a5c59d4417
2026-07-26-07-01-41.gh-issue-153711.ad8g_Q.rst https://github.com/python/cpython/pull/154718/files#diff-cd63ec6bf217b0406dd9e74c88dd2bd8a5b810a10183442ba679042097e02bfb
posixmodule.c https://github.com/python/cpython/pull/154718/files#diff-b5b7e4f5599916b2018e911ef423f9d3fd46cb71268e1a73c74a1c9ae2cb6791
Doc/library/os.rsthttps://github.com/python/cpython/pull/154718/files#diff-cd9132e5234678864807ae34a75c5d4d6b894b31c327a4d3620fbd0c37eec16e
View file https://github.com/Vamsi-klu/cpython/blob/548b366f3bcaa1c151c027430d108f29463f24de/Doc/library/os.rst
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/154718/{{ revealButtonHref }}
https://github.com/python/cpython/pull/154718/files#diff-cd9132e5234678864807ae34a75c5d4d6b894b31c327a4d3620fbd0c37eec16e
chatgpt-codex-connectorhttps://github.com/apps/chatgpt-codex-connector
Jul 26, 2026https://github.com/python/cpython/pull/154718/files#r3652009458
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
https://camo.githubusercontent.com/0854bfc38139c0d2b58a9d5d71f5ad92840cf0c17144621e462b474041793354/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f50322d79656c6c6f773f7374796c653d666c6174
Please reload this pagehttps://github.com/python/cpython/pull/154718/files
https://github.com/python/cpython/pull/154718/files#diff-cd9132e5234678864807ae34a75c5d4d6b894b31c327a4d3620fbd0c37eec16e
Lib/test/test_os/test_posix.pyhttps://github.com/python/cpython/pull/154718/files#diff-c2ffce99c501f7f4b6bde21947391671e95f592edcdf8bddbe4706a5c59d4417
View file https://github.com/Vamsi-klu/cpython/blob/548b366f3bcaa1c151c027430d108f29463f24de/Lib/test/test_os/test_posix.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/154718/{{ revealButtonHref }}
https://github.com/python/cpython/pull/154718/files#diff-c2ffce99c501f7f4b6bde21947391671e95f592edcdf8bddbe4706a5c59d4417
https://github.com/python/cpython/pull/154718/files#diff-c2ffce99c501f7f4b6bde21947391671e95f592edcdf8bddbe4706a5c59d4417
Misc/NEWS.d/next/macOS/2026-07-26-07-01-41.gh-issue-153711.ad8g_Q.rsthttps://github.com/python/cpython/pull/154718/files#diff-cd63ec6bf217b0406dd9e74c88dd2bd8a5b810a10183442ba679042097e02bfb
View file https://github.com/Vamsi-klu/cpython/blob/548b366f3bcaa1c151c027430d108f29463f24de/Misc/NEWS.d/next/macOS/2026-07-26-07-01-41.gh-issue-153711.ad8g_Q.rst
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/154718/{{ revealButtonHref }}
Modules/posixmodule.chttps://github.com/python/cpython/pull/154718/files#diff-b5b7e4f5599916b2018e911ef423f9d3fd46cb71268e1a73c74a1c9ae2cb6791
View file https://github.com/Vamsi-klu/cpython/blob/548b366f3bcaa1c151c027430d108f29463f24de/Modules/posixmodule.c
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/154718/{{ revealButtonHref }}
https://github.com/python/cpython/pull/154718/files#diff-b5b7e4f5599916b2018e911ef423f9d3fd46cb71268e1a73c74a1c9ae2cb6791
https://github.com/python/cpython/pull/154718/files#diff-b5b7e4f5599916b2018e911ef423f9d3fd46cb71268e1a73c74a1c9ae2cb6791
https://github.com/python/cpython/pull/154718/files#diff-b5b7e4f5599916b2018e911ef423f9d3fd46cb71268e1a73c74a1c9ae2cb6791
https://github.com/python/cpython/pull/154718/files#diff-b5b7e4f5599916b2018e911ef423f9d3fd46cb71268e1a73c74a1c9ae2cb6791
https://github.com/python/cpython/pull/154718/files#diff-b5b7e4f5599916b2018e911ef423f9d3fd46cb71268e1a73c74a1c9ae2cb6791
https://github.com/python/cpython/pull/154718/files#diff-b5b7e4f5599916b2018e911ef423f9d3fd46cb71268e1a73c74a1c9ae2cb6791
https://github.com/python/cpython/pull/154718/files#diff-b5b7e4f5599916b2018e911ef423f9d3fd46cb71268e1a73c74a1c9ae2cb6791
https://github.com/python/cpython/pull/154718/files#diff-b5b7e4f5599916b2018e911ef423f9d3fd46cb71268e1a73c74a1c9ae2cb6791
https://github.com/python/cpython/pull/154718/files#diff-b5b7e4f5599916b2018e911ef423f9d3fd46cb71268e1a73c74a1c9ae2cb6791
https://github.com/python/cpython/pull/154718/files#diff-b5b7e4f5599916b2018e911ef423f9d3fd46cb71268e1a73c74a1c9ae2cb6791
https://github.com/python/cpython/pull/154718/files#diff-b5b7e4f5599916b2018e911ef423f9d3fd46cb71268e1a73c74a1c9ae2cb6791
chatgpt-codex-connectorhttps://github.com/apps/chatgpt-codex-connector
Jul 26, 2026https://github.com/python/cpython/pull/154718/files#r3651994660
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
https://camo.githubusercontent.com/a08bbb8a949f7033433a88444eeae385ff6a5e599d92f878fb05fa85707b7816/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f50312d6f72616e67653f7374796c653d666c6174
Please reload this pagehttps://github.com/python/cpython/pull/154718/files
https://github.com/python/cpython/pull/154718/files#diff-b5b7e4f5599916b2018e911ef423f9d3fd46cb71268e1a73c74a1c9ae2cb6791
Please reload this pagehttps://github.com/python/cpython/pull/154718/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.