René's URL Explorer Experiment


Title: gh-109714: Improve the OSError constructor by serhiy-storchaka · Pull Request #156430 · python/cpython · GitHub

Open Graph Title: gh-109714: Improve the OSError constructor by serhiy-storchaka · Pull Request #156430 · python/cpython

X Title: gh-109714: Improve the OSError constructor by serhiy-storchaka · Pull Request #156430 · python/cpython

Description: The errno and strerror arguments of the OSError constructor can now be omitted. errno defaults to the error code which corresponds to the exception class, exposed as the new default_errno class attribute, so that FileNotFoundError() works both with code that tests the errno attribute and with code that uses isinstance(). strerror is derived from the resulting errno, or on Windows from winerror if that was given, whose message is more specific. filename, winerror and filename2 can now be passed by keyword, as can characters_written for BlockingIOError. >>> str(FileNotFoundError(filename='cfg.ini')) "[Errno 2] No such file or directory: 'cfg.ini'" args is now set to the canonical positional form, so that OSError(*args) reproduces the exception, which is how it is pickled. It used to be truncated to two items whenever a file name was consumed, so an exception carrying one did not survive pickling. Incompatible changes: Passing more than five positional arguments is now a TypeError, instead of being silently ignored. args keeps the file names, so OSError(2, 'm', 'f').args is the whole 3-tuple rather than (2, 'm'). A file name given explicitly as None is not stored on the exception, so the args of a pickled OSError(2, 'm', None) lose the trailing None. Issue: gh-109714

Open Graph Description: The errno and strerror arguments of the OSError constructor can now be omitted. errno defaults to the error code which corresponds to the exception class, exposed as the new default_errno class att...

X Description: The errno and strerror arguments of the OSError constructor can now be omitted. errno defaults to the error code which corresponds to the exception class, exposed as the new default_errno class att...

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

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:66bd224d-68d9-b050-6535-e8c76fbe55a8
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-id87AA:3F9D33:2B33B28:3ADC1F0:6B00549D
html-safe-nonce73fcd3cbad557d22743e42b15b822b46a6c10831551dffa9c9a2a0c1ab6d979d
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4N0FBOjNGOUQzMzoyQjMzQjI4OjNBREMxRjA6NkIwMDU0OUQiLCJ2aXNpdG9yX2lkIjoiNDQxMzAyODQzNjg2NDQyMzA2OSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac985732b642b25d8a01ba6c0c0c04c350efab609b3a857b2346ab6e0409a73c4a
hovercard-subject-tagpull_request:4370495759
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/156430/files
twitter:imagehttps://avatars.githubusercontent.com/u/3659035?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/3659035?s=400&v=4
og:image:altThe errno and strerror arguments of the OSError constructor can now be omitted. errno defaults to the error code which corresponds to the exception class, exposed as the new default_errno class att...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
Nonef420f4996e6b1ff1ccd6d7683f8134f4b5f0f8a50124c210dbfe7490e5644abb
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
release26e00df917aba0f128135dc073ea0c5e33a70d40
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/python/cpython/pull/156430/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fpull%2F156430%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%2F156430%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/156430/files
Reloadhttps://github.com/python/cpython/pull/156430/files
Reloadhttps://github.com/python/cpython/pull/156430/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
serhiy-storchakahttps://github.com/serhiy-storchaka
python:mainhttps://github.com/python/cpython/tree/main
serhiy-storchaka:oserror-default-errnohttps://github.com/serhiy-storchaka/cpython/tree/oserror-default-errno
Conversation 1 https://github.com/python/cpython/pull/156430
Commits 2 https://github.com/python/cpython/pull/156430/commits
Checks 50 https://github.com/python/cpython/pull/156430/checks
Files changed https://github.com/python/cpython/pull/156430/files
Please reload this pagehttps://github.com/python/cpython/pull/156430/files
gh-109714: Improve the OSError constructor https://github.com/python/cpython/pull/156430/files#top
Show all changes 2 commits https://github.com/python/cpython/pull/156430/files
71331e7 gh-109714: Improve the OSError constructor serhiy-storchaka Aug 26, 2026 https://github.com/python/cpython/pull/156430/commits/71331e70cc2c441ecc18c28e966fb56b02bd3056
cb81f83 Merge remote-tracking branch 'upstream/main' into oserror-default-errno serhiy-storchaka Sep 13, 2026 https://github.com/python/cpython/pull/156430/commits/cb81f8398d048c221cb5880dd508b2e8e446e2c7
Clear filters https://github.com/python/cpython/pull/156430/files
Please reload this pagehttps://github.com/python/cpython/pull/156430/files
Please reload this pagehttps://github.com/python/cpython/pull/156430/files
exceptions.rst https://github.com/python/cpython/pull/156430/files#diff-50afabcd8003fedfc4e1ff12e126e8a6b531f67b218e565dcb1303944e1c2b5b
3.16.rst https://github.com/python/cpython/pull/156430/files#diff-e69e0be717f3409832d520e20348f62af39c9436ba1a9d82e842bc10e5eb51d7
pycore_pyerrors.h https://github.com/python/cpython/pull/156430/files#diff-369651c1fa6d49298aa234ee75042525ef4bf3ebe405d275156d96dd5d6f11ca
test_exceptions.py https://github.com/python/cpython/pull/156430/files#diff-7c2307b287712224bf6f6152a4a15e94c86b0fe750599a068f4bb6799dcc07e7
test_as_completed.py https://github.com/python/cpython/pull/156430/files#diff-3304f9d2d0d00bcbe21acef8692f74a3dc55741a5790711a429e21517577e8ca
test_exception_hierarchy.py https://github.com/python/cpython/pull/156430/files#diff-769168b1ad67e36ad371f32f7e2e4238ca48764dc10d8b6b807a9223fa78b36f
test_exceptions.py https://github.com/python/cpython/pull/156430/files#diff-3dbd58a46964dc5908595a1caa552fa3f5e2e46610679634ffc1064fd7cc3c8f
test_xpickle.py https://github.com/python/cpython/pull/156430/files#diff-636b4ff0df0c6bd70f63ba805729dca4e2dda3a506338cbf50faaf298a32f4cf
2026-08-26-11-42-18.gh-issue-109714.Kq3Rvb.rst https://github.com/python/cpython/pull/156430/files#diff-064257013f2473c6d2fa41b9b15e26e0f33958bd7ac9ff3ae8bc334ae1cf5e92
exceptions.c https://github.com/python/cpython/pull/156430/files#diff-96c4ad902cdfac48712fef8fff0d0c78a71eb135fb48264f3ebb67db1013fc94
errors.c https://github.com/python/cpython/pull/156430/files#diff-c37c836d0535b79d87b8eb0652c59ac0c2aeb1461bcb2274bee82656cecacad4
Doc/library/exceptions.rsthttps://github.com/python/cpython/pull/156430/files#diff-50afabcd8003fedfc4e1ff12e126e8a6b531f67b218e565dcb1303944e1c2b5b
View file https://github.com/python/cpython/blob/cb81f8398d048c221cb5880dd508b2e8e446e2c7/Doc/library/exceptions.rst
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/156430/{{ revealButtonHref }}
https://github.com/python/cpython/pull/156430/files#diff-50afabcd8003fedfc4e1ff12e126e8a6b531f67b218e565dcb1303944e1c2b5b
https://github.com/python/cpython/pull/156430/files#diff-50afabcd8003fedfc4e1ff12e126e8a6b531f67b218e565dcb1303944e1c2b5b
https://github.com/python/cpython/pull/156430/files#diff-50afabcd8003fedfc4e1ff12e126e8a6b531f67b218e565dcb1303944e1c2b5b
https://github.com/python/cpython/pull/156430/files#diff-50afabcd8003fedfc4e1ff12e126e8a6b531f67b218e565dcb1303944e1c2b5b
https://github.com/python/cpython/pull/156430/files#diff-50afabcd8003fedfc4e1ff12e126e8a6b531f67b218e565dcb1303944e1c2b5b
https://github.com/python/cpython/pull/156430/files#diff-50afabcd8003fedfc4e1ff12e126e8a6b531f67b218e565dcb1303944e1c2b5b
https://github.com/python/cpython/pull/156430/files#diff-50afabcd8003fedfc4e1ff12e126e8a6b531f67b218e565dcb1303944e1c2b5b
https://github.com/python/cpython/pull/156430/files#diff-50afabcd8003fedfc4e1ff12e126e8a6b531f67b218e565dcb1303944e1c2b5b
https://github.com/python/cpython/blob/main/.github/CODEOWNERS#L116
Doc/whatsnew/3.16.rsthttps://github.com/python/cpython/pull/156430/files#diff-e69e0be717f3409832d520e20348f62af39c9436ba1a9d82e842bc10e5eb51d7
View file https://github.com/python/cpython/blob/cb81f8398d048c221cb5880dd508b2e8e446e2c7/Doc/whatsnew/3.16.rst
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/156430/{{ revealButtonHref }}
https://github.com/python/cpython/pull/156430/files#diff-e69e0be717f3409832d520e20348f62af39c9436ba1a9d82e842bc10e5eb51d7
https://github.com/python/cpython/pull/156430/files#diff-e69e0be717f3409832d520e20348f62af39c9436ba1a9d82e842bc10e5eb51d7
https://github.com/python/cpython/pull/156430/files#diff-e69e0be717f3409832d520e20348f62af39c9436ba1a9d82e842bc10e5eb51d7
https://github.com/python/cpython/pull/156430/files#diff-e69e0be717f3409832d520e20348f62af39c9436ba1a9d82e842bc10e5eb51d7
Include/internal/pycore_pyerrors.hhttps://github.com/python/cpython/pull/156430/files#diff-369651c1fa6d49298aa234ee75042525ef4bf3ebe405d275156d96dd5d6f11ca
View file https://github.com/python/cpython/blob/cb81f8398d048c221cb5880dd508b2e8e446e2c7/Include/internal/pycore_pyerrors.h
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/156430/{{ revealButtonHref }}
https://github.com/python/cpython/pull/156430/files#diff-369651c1fa6d49298aa234ee75042525ef4bf3ebe405d275156d96dd5d6f11ca
https://github.com/python/cpython/pull/156430/files#diff-369651c1fa6d49298aa234ee75042525ef4bf3ebe405d275156d96dd5d6f11ca
Lib/test/test_capi/test_exceptions.pyhttps://github.com/python/cpython/pull/156430/files#diff-7c2307b287712224bf6f6152a4a15e94c86b0fe750599a068f4bb6799dcc07e7
View file https://github.com/python/cpython/blob/cb81f8398d048c221cb5880dd508b2e8e446e2c7/Lib/test/test_capi/test_exceptions.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/156430/{{ revealButtonHref }}
https://github.com/python/cpython/pull/156430/files#diff-7c2307b287712224bf6f6152a4a15e94c86b0fe750599a068f4bb6799dcc07e7
https://github.com/python/cpython/pull/156430/files#diff-7c2307b287712224bf6f6152a4a15e94c86b0fe750599a068f4bb6799dcc07e7
https://github.com/python/cpython/pull/156430/files#diff-7c2307b287712224bf6f6152a4a15e94c86b0fe750599a068f4bb6799dcc07e7
https://github.com/python/cpython/pull/156430/files#diff-7c2307b287712224bf6f6152a4a15e94c86b0fe750599a068f4bb6799dcc07e7
https://github.com/python/cpython/pull/156430/files#diff-7c2307b287712224bf6f6152a4a15e94c86b0fe750599a068f4bb6799dcc07e7
Lib/test/test_concurrent_futures/test_as_completed.pyhttps://github.com/python/cpython/pull/156430/files#diff-3304f9d2d0d00bcbe21acef8692f74a3dc55741a5790711a429e21517577e8ca
View file https://github.com/python/cpython/blob/cb81f8398d048c221cb5880dd508b2e8e446e2c7/Lib/test/test_concurrent_futures/test_as_completed.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/156430/{{ revealButtonHref }}
https://github.com/python/cpython/pull/156430/files#diff-3304f9d2d0d00bcbe21acef8692f74a3dc55741a5790711a429e21517577e8ca
https://github.com/python/cpython/pull/156430/files#diff-3304f9d2d0d00bcbe21acef8692f74a3dc55741a5790711a429e21517577e8ca
https://github.com/python/cpython/blob/main/.github/CODEOWNERS#L247
Lib/test/test_exception_hierarchy.pyhttps://github.com/python/cpython/pull/156430/files#diff-769168b1ad67e36ad371f32f7e2e4238ca48764dc10d8b6b807a9223fa78b36f
View file https://github.com/python/cpython/blob/cb81f8398d048c221cb5880dd508b2e8e446e2c7/Lib/test/test_exception_hierarchy.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/156430/{{ revealButtonHref }}
https://github.com/python/cpython/pull/156430/files#diff-769168b1ad67e36ad371f32f7e2e4238ca48764dc10d8b6b807a9223fa78b36f
https://github.com/python/cpython/pull/156430/files#diff-769168b1ad67e36ad371f32f7e2e4238ca48764dc10d8b6b807a9223fa78b36f
https://github.com/python/cpython/pull/156430/files#diff-769168b1ad67e36ad371f32f7e2e4238ca48764dc10d8b6b807a9223fa78b36f
https://github.com/python/cpython/pull/156430/files#diff-769168b1ad67e36ad371f32f7e2e4238ca48764dc10d8b6b807a9223fa78b36f
https://github.com/python/cpython/pull/156430/files#diff-769168b1ad67e36ad371f32f7e2e4238ca48764dc10d8b6b807a9223fa78b36f
https://github.com/python/cpython/pull/156430/files#diff-769168b1ad67e36ad371f32f7e2e4238ca48764dc10d8b6b807a9223fa78b36f
Please reload this pagehttps://github.com/python/cpython/pull/156430/files
Please reload this pagehttps://github.com/python/cpython/pull/156430/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.