René's URL Explorer Experiment


Title: gh-155907: Raise OSError and KeyboardInterrupt when reading marshal data by serhiy-storchaka · Pull Request #155909 · python/cpython · GitHub

Open Graph Title: gh-155907: Raise OSError and KeyboardInterrupt when reading marshal data by serhiy-storchaka · Pull Request #155909 · python/cpython

X Title: gh-155907: Raise OSError and KeyboardInterrupt when reading marshal data by serhiy-storchaka · Pull Request #155909 · python/cpython

Description: r_string(), r_byte() and PyMarshal_ReadLastObjectFromFile() did not check ferror() nor call PyErr_CheckSignals(), so a genuine I/O error or a read interrupted by Ctrl-C was reported as EOFError, as if the file had simply ended. >>> import _testcapi, os >>> os.mkdir('d') >>> _testcapi.pymarshal_read_object_from_file('d') EOFError: EOF read where object expected # before IsADirectoryError: [Errno 21] Is a directory # after The writing side had the same gap: w_flush() and w_string() discarded the result of fwrite(), so a failed or interrupted write to a FILE* was ignored. PyMarshal_WriteObjectToFile() also never turned the recorded WFERR_* code into an exception, so even an unmarshallable value was ignored. >>> import _testcapi, marshal >>> _testcapi.pymarshal_write_object_to_file(b'x' * 100000, '/dev/full', marshal.version) # before: no error OSError: [Errno 28] No space left on device # after >>> _testcapi.pymarshal_write_object_to_file(object(), 'f', marshal.version) # before: no error ValueError: unmarshallable object # after The WFERR_* to exception mapping is factored out of PyMarshal_WriteObjectToString() into w_set_error(), and all three writers now use it. This removes the note above PyMarshal_WriteLongToFile() saying that it never sets an exception and that doing so "should be regarded as an API-breaking change": detecting write errors makes it set one, which is what its documentation has promised since gh-105184. The documentation of these functions listed only EOFError, ValueError and TypeError, which was inaccurate even before this change (MemoryError is raised when the read buffer cannot be allocated), so the per-function lists are replaced by one list for the whole section. Issue: gh-155907

Open Graph Description: r_string(), r_byte() and PyMarshal_ReadLastObjectFromFile() did not check ferror() nor call PyErr_CheckSignals(), so a genuine I/O error or a read interrupted by Ctrl-C was reported as EOFError, as...

X Description: r_string(), r_byte() and PyMarshal_ReadLastObjectFromFile() did not check ferror() nor call PyErr_CheckSignals(), so a genuine I/O error or a read interrupted by Ctrl-C was reported as EOFError, as...

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

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:c24571f5-56e7-3c7b-61ee-b1c5cb44beee
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idBC08:299992:1AC1E72:2347FB1:6B0218A0
html-safe-noncea518ac688ad30608f3b5dd3c1434f92f821948989bf4f6b66d58fc586d24188d
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCQzA4OjI5OTk5MjoxQUMxRTcyOjIzNDdGQjE6NkIwMjE4QTAiLCJ2aXNpdG9yX2lkIjoiMzUxOTc0ODU0NTc5ODM0NjkxMiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac108019f27dba049dd3d5e88b31ebcdee05dc765d3a7951f7150f3552928a1d6c
hovercard-subject-tagpull_request:4291068555
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/155909/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:altr_string(), r_byte() and PyMarshal_ReadLastObjectFromFile() did not check ferror() nor call PyErr_CheckSignals(), so a genuine I/O error or a read interrupted by Ctrl-C was reported as EOFError, as...
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/155909/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fpull%2F155909%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%2F155909%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/155909/files
Reloadhttps://github.com/python/cpython/pull/155909/files
Reloadhttps://github.com/python/cpython/pull/155909/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:marshal-read-errorshttps://github.com/serhiy-storchaka/cpython/tree/marshal-read-errors
Conversation 14 https://github.com/python/cpython/pull/155909
Commits 6 https://github.com/python/cpython/pull/155909/commits
Checks 52 https://github.com/python/cpython/pull/155909/checks
Files changed https://github.com/python/cpython/pull/155909/files
Please reload this pagehttps://github.com/python/cpython/pull/155909/files
gh-155907: Raise OSError and KeyboardInterrupt when reading marshal data https://github.com/python/cpython/pull/155909/files#top
Show all changes 6 commits https://github.com/python/cpython/pull/155909/files
2c5579a gh-155907: Raise OSError and KeyboardInterrupt when reading marshal data serhiy-storchaka Aug 16, 2026 https://github.com/python/cpython/pull/155909/commits/2c5579a74acf03778d54aefe9c5b3e65fcba288e
fecb4a0 Merge branch 'main' into marshal-read-errors serhiy-storchaka Aug 29, 2026 https://github.com/python/cpython/pull/155909/commits/fecb4a018e224f254ddbff4fb179dbb3f5540754
1a321fb Merge branch 'main' into marshal-read-errors serhiy-storchaka Aug 29, 2026 https://github.com/python/cpython/pull/155909/commits/1a321fb5c10e01bf72771e0cfe4921633832ce58
ed7d607 Detect I/O errors and signals when writing marshalled data serhiy-storchaka Aug 29, 2026 https://github.com/python/cpython/pull/155909/commits/ed7d607710685d439d20745645a8f775147508db
9b05276 Address review comments serhiy-storchaka Sep 4, 2026 https://github.com/python/cpython/pull/155909/commits/9b05276dd752a766e1f0616ccb47823b4c2cd6c8
01413ca Rename WFERR_ERROR_SET to WFERR_EXCEPTION_SET serhiy-storchaka Sep 4, 2026 https://github.com/python/cpython/pull/155909/commits/01413ca842dcb3980e4bd3dc016a513225e313d5
Clear filters https://github.com/python/cpython/pull/155909/files
Please reload this pagehttps://github.com/python/cpython/pull/155909/files
Please reload this pagehttps://github.com/python/cpython/pull/155909/files
marshal.rst https://github.com/python/cpython/pull/155909/files#diff-9552e29b14533f455241dfb30a7a184a94f7d1600c6c0f52807dc1f7b6083d4e
3.16.rst https://github.com/python/cpython/pull/155909/files#diff-e69e0be717f3409832d520e20348f62af39c9436ba1a9d82e842bc10e5eb51d7
test_marshal.py https://github.com/python/cpython/pull/155909/files#diff-8201bccab835556960180c83492e252bf18bc045bc0dfacf9b290613a4d46269
2026-08-16-20-48-08.gh-issue-155907.Vb3xTn.rst https://github.com/python/cpython/pull/155909/files#diff-94fe4721ac53a19722db18e11478695ee481d8001e5fcff25e00ffabaa0f2566
_testcapimodule.c https://github.com/python/cpython/pull/155909/files#diff-b2d7540efa4f376350ef77b923a6dfcc54bb90424970477f66275f19bad0d30f
marshal.c https://github.com/python/cpython/pull/155909/files#diff-46d545a32ea7176926cf1a963f25cdac2cf1c8098b3e020ccc77b63b2149d760
https://github.com/python/cpython/blob/main/.github/CODEOWNERS#L114
Doc/c-api/marshal.rsthttps://github.com/python/cpython/pull/155909/files#diff-9552e29b14533f455241dfb30a7a184a94f7d1600c6c0f52807dc1f7b6083d4e
View file https://github.com/serhiy-storchaka/cpython/blob/01413ca842dcb3980e4bd3dc016a513225e313d5/Doc/c-api/marshal.rst
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/155909/{{ revealButtonHref }}
https://github.com/python/cpython/pull/155909/files#diff-9552e29b14533f455241dfb30a7a184a94f7d1600c6c0f52807dc1f7b6083d4e
vstinnerhttps://github.com/vstinner
Sep 3, 2026https://github.com/python/cpython/pull/155909/files#r3926880528
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
Please reload this pagehttps://github.com/python/cpython/pull/155909/files
serhiy-storchakahttps://github.com/serhiy-storchaka
Sep 4, 2026https://github.com/python/cpython/pull/155909/files#r3934020510
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
Please reload this pagehttps://github.com/python/cpython/pull/155909/files
vstinnerhttps://github.com/vstinner
Sep 4, 2026https://github.com/python/cpython/pull/155909/files#r3934222561
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
Please reload this pagehttps://github.com/python/cpython/pull/155909/files
https://github.com/python/cpython/pull/155909/files#diff-9552e29b14533f455241dfb30a7a184a94f7d1600c6c0f52807dc1f7b6083d4e
https://github.com/python/cpython/pull/155909/files#diff-9552e29b14533f455241dfb30a7a184a94f7d1600c6c0f52807dc1f7b6083d4e
https://github.com/python/cpython/pull/155909/files#diff-9552e29b14533f455241dfb30a7a184a94f7d1600c6c0f52807dc1f7b6083d4e
https://github.com/python/cpython/pull/155909/files#diff-9552e29b14533f455241dfb30a7a184a94f7d1600c6c0f52807dc1f7b6083d4e
https://github.com/python/cpython/blob/main/.github/CODEOWNERS#L116
Doc/whatsnew/3.16.rsthttps://github.com/python/cpython/pull/155909/files#diff-e69e0be717f3409832d520e20348f62af39c9436ba1a9d82e842bc10e5eb51d7
View file https://github.com/serhiy-storchaka/cpython/blob/01413ca842dcb3980e4bd3dc016a513225e313d5/Doc/whatsnew/3.16.rst
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/155909/{{ revealButtonHref }}
https://github.com/python/cpython/pull/155909/files#diff-e69e0be717f3409832d520e20348f62af39c9436ba1a9d82e842bc10e5eb51d7
https://github.com/python/cpython/pull/155909/files#diff-e69e0be717f3409832d520e20348f62af39c9436ba1a9d82e842bc10e5eb51d7
Lib/test/test_marshal.pyhttps://github.com/python/cpython/pull/155909/files#diff-8201bccab835556960180c83492e252bf18bc045bc0dfacf9b290613a4d46269
View file https://github.com/serhiy-storchaka/cpython/blob/01413ca842dcb3980e4bd3dc016a513225e313d5/Lib/test/test_marshal.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/155909/{{ revealButtonHref }}
https://github.com/python/cpython/pull/155909/files#diff-8201bccab835556960180c83492e252bf18bc045bc0dfacf9b290613a4d46269
https://github.com/python/cpython/pull/155909/files#diff-8201bccab835556960180c83492e252bf18bc045bc0dfacf9b290613a4d46269
Misc/NEWS.d/next/C_API/2026-08-16-20-48-08.gh-issue-155907.Vb3xTn.rsthttps://github.com/python/cpython/pull/155909/files#diff-94fe4721ac53a19722db18e11478695ee481d8001e5fcff25e00ffabaa0f2566
View file https://github.com/serhiy-storchaka/cpython/blob/01413ca842dcb3980e4bd3dc016a513225e313d5/Misc/NEWS.d/next/C_API/2026-08-16-20-48-08.gh-issue-155907.Vb3xTn.rst
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/155909/{{ revealButtonHref }}
Modules/_testcapimodule.chttps://github.com/python/cpython/pull/155909/files#diff-b2d7540efa4f376350ef77b923a6dfcc54bb90424970477f66275f19bad0d30f
View file https://github.com/serhiy-storchaka/cpython/blob/01413ca842dcb3980e4bd3dc016a513225e313d5/Modules/_testcapimodule.c
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/155909/{{ revealButtonHref }}
https://github.com/python/cpython/pull/155909/files#diff-b2d7540efa4f376350ef77b923a6dfcc54bb90424970477f66275f19bad0d30f
https://github.com/python/cpython/pull/155909/files#diff-b2d7540efa4f376350ef77b923a6dfcc54bb90424970477f66275f19bad0d30f
https://github.com/python/cpython/pull/155909/files#diff-b2d7540efa4f376350ef77b923a6dfcc54bb90424970477f66275f19bad0d30f
Python/marshal.chttps://github.com/python/cpython/pull/155909/files#diff-46d545a32ea7176926cf1a963f25cdac2cf1c8098b3e020ccc77b63b2149d760
View file https://github.com/serhiy-storchaka/cpython/blob/01413ca842dcb3980e4bd3dc016a513225e313d5/Python/marshal.c
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/155909/{{ revealButtonHref }}
https://github.com/python/cpython/pull/155909/files#diff-46d545a32ea7176926cf1a963f25cdac2cf1c8098b3e020ccc77b63b2149d760
https://github.com/python/cpython/pull/155909/files#diff-46d545a32ea7176926cf1a963f25cdac2cf1c8098b3e020ccc77b63b2149d760
https://github.com/python/cpython/pull/155909/files#diff-46d545a32ea7176926cf1a963f25cdac2cf1c8098b3e020ccc77b63b2149d760
https://github.com/python/cpython/pull/155909/files#diff-46d545a32ea7176926cf1a963f25cdac2cf1c8098b3e020ccc77b63b2149d760
https://github.com/python/cpython/pull/155909/files#diff-46d545a32ea7176926cf1a963f25cdac2cf1c8098b3e020ccc77b63b2149d760
https://github.com/python/cpython/pull/155909/files#diff-46d545a32ea7176926cf1a963f25cdac2cf1c8098b3e020ccc77b63b2149d760
https://github.com/python/cpython/pull/155909/files#diff-46d545a32ea7176926cf1a963f25cdac2cf1c8098b3e020ccc77b63b2149d760
https://github.com/python/cpython/pull/155909/files#diff-46d545a32ea7176926cf1a963f25cdac2cf1c8098b3e020ccc77b63b2149d760
https://github.com/python/cpython/pull/155909/files#diff-46d545a32ea7176926cf1a963f25cdac2cf1c8098b3e020ccc77b63b2149d760
https://github.com/python/cpython/pull/155909/files#diff-46d545a32ea7176926cf1a963f25cdac2cf1c8098b3e020ccc77b63b2149d760
Please reload this pagehttps://github.com/python/cpython/pull/155909/files
https://github.com/python/cpython/pull/155909/files#diff-46d545a32ea7176926cf1a963f25cdac2cf1c8098b3e020ccc77b63b2149d760
Please reload this pagehttps://github.com/python/cpython/pull/155909/files
https://github.com/python/cpython/pull/155909/files#diff-46d545a32ea7176926cf1a963f25cdac2cf1c8098b3e020ccc77b63b2149d760
https://github.com/python/cpython/pull/155909/files#diff-46d545a32ea7176926cf1a963f25cdac2cf1c8098b3e020ccc77b63b2149d760
https://github.com/python/cpython/pull/155909/files#diff-46d545a32ea7176926cf1a963f25cdac2cf1c8098b3e020ccc77b63b2149d760
https://github.com/python/cpython/pull/155909/files#diff-46d545a32ea7176926cf1a963f25cdac2cf1c8098b3e020ccc77b63b2149d760
https://github.com/python/cpython/pull/155909/files#diff-46d545a32ea7176926cf1a963f25cdac2cf1c8098b3e020ccc77b63b2149d760
https://github.com/python/cpython/pull/155909/files#diff-46d545a32ea7176926cf1a963f25cdac2cf1c8098b3e020ccc77b63b2149d760
Please reload this pagehttps://github.com/python/cpython/pull/155909/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.