René's URL Explorer Experiment


Title: gh-104223: Fix issues with inheriting from buffer classes by JelleZijlstra · Pull Request #104227 · python/cpython · GitHub

Open Graph Title: gh-104223: Fix issues with inheriting from buffer classes by JelleZijlstra · Pull Request #104227 · python/cpython

X Title: gh-104223: Fix issues with inheriting from buffer classes by JelleZijlstra · Pull Request #104227 · python/cpython

Description: This fixes various issues that crop up when inheriting from a class that implements the C buffer protocol. In wrap_buffer, we need to make sure to call the exact slot that we're wrapping, or we might recursively call ourselves inside a call to super(). In bufferwrapper_releasebuf, we should only call the bf_releasebuf slot if it's a Python function. If it's a C slot inherited from a base class, it will just be called when we release the memoryview. The C bf_releasebuf slot of classes that inherit from C buffer classes was not called. Fix this. The wrapper memoryview created in releasebuffer_call_python allowed a use-after-free. To guard against that, create a new restricted-mode memoryview that does not allow the user to hold on to the buffer. Issue: gh-104223

Open Graph Description: This fixes various issues that crop up when inheriting from a class that implements the C buffer protocol. In wrap_buffer, we need to make sure to call the exact slot that we're wrapping, or w...

X Description: This fixes various issues that crop up when inheriting from a class that implements the C buffer protocol. In wrap_buffer, we need to make sure to call the exact slot that we're wrapping, ...

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

X: @github

direct link

Domain: github.com

route-pattern/:user_id/:repository/pull/:id/commits/:range(.:format)
route-controllerpull_requests
route-actioncommits
fetch-noncev2:7d7d51e6-3642-f882-432d-229476a6447d
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idB9DC:4CE4D:57BF306:76954A3:6995C29A
html-safe-nonce1a255a898769ad0eacadd65191e70259f6b5e5fac81ea01273bd4d80b7c2f84f
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCOURDOjRDRTREOjU3QkYzMDY6NzY5NTRBMzo2OTk1QzI5QSIsInZpc2l0b3JfaWQiOiIyNTcyMTQyODI0NTYxOTUxMzg2IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac212e33ca8a38f4d94c0958074e0871212e5a4ef83cf7e33977458594ca4fda87
hovercard-subject-tagpull_request:1340616238
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/commits
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/python/cpython/pull/104227/commits/b7fb7a47071bb85c054576d6e0cb17b6622505e2
twitter:imagehttps://avatars.githubusercontent.com/u/906600?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/906600?s=400&v=4
og:image:altThis fixes various issues that crop up when inheriting from a class that implements the C buffer protocol. In wrap_buffer, we need to make sure to call the exact slot that we're wrapping, or w...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None0f7f0c08152b2fbe00b7a94c0999555da729903b87c8fcd49e22663191f98790
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-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release3d0b59e9687d50052add63b746d8fab1d277b58a
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/python/cpython/pull/104227/commits/b7fb7a47071bb85c054576d6e0cb17b6622505e2#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fpull%2F104227%2Fcommits%2Fb7fb7a47071bb85c054576d6e0cb17b6622505e2
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub SparkBuild and deploy intelligent appshttps://github.com/features/spark
GitHub ModelsManage and compare promptshttps://github.com/features/models
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
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
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://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/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fpull%2F104227%2Fcommits%2Fb7fb7a47071bb85c054576d6e0cb17b6622505e2
Sign up https://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%2Fcommits&source=header-repo&source_repo=python%2Fcpython
Reloadhttps://github.com/python/cpython/pull/104227/commits/b7fb7a47071bb85c054576d6e0cb17b6622505e2
Reloadhttps://github.com/python/cpython/pull/104227/commits/b7fb7a47071bb85c054576d6e0cb17b6622505e2
Reloadhttps://github.com/python/cpython/pull/104227/commits/b7fb7a47071bb85c054576d6e0cb17b6622505e2
python https://github.com/python
cpythonhttps://github.com/python/cpython
Please reload this pagehttps://github.com/python/cpython/pull/104227/commits/b7fb7a47071bb85c054576d6e0cb17b6622505e2
Notifications https://github.com/login?return_to=%2Fpython%2Fcpython
Fork 34.1k https://github.com/login?return_to=%2Fpython%2Fcpython
Star 71.5k https://github.com/login?return_to=%2Fpython%2Fcpython
Code https://github.com/python/cpython
Issues 5k+ https://github.com/python/cpython/issues
Pull requests 2.1k https://github.com/python/cpython/pulls
Actions https://github.com/python/cpython/actions
Projects 31 https://github.com/python/cpython/projects
Security 0 https://github.com/python/cpython/security
Insights https://github.com/python/cpython/pulse
Code https://github.com/python/cpython
Issues https://github.com/python/cpython/issues
Pull requests https://github.com/python/cpython/pulls
Actions https://github.com/python/cpython/actions
Projects https://github.com/python/cpython/projects
Security https://github.com/python/cpython/security
Insights https://github.com/python/cpython/pulse
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
JelleZijlstrahttps://github.com/JelleZijlstra
python:mainhttps://github.com/python/cpython/tree/main
JelleZijlstra:pep688fixhttps://github.com/JelleZijlstra/cpython/tree/pep688fix
Conversation 20 https://github.com/python/cpython/pull/104227
Commits 14 https://github.com/python/cpython/pull/104227/commits
Checks 0 https://github.com/python/cpython/pull/104227/checks
Files changed https://github.com/python/cpython/pull/104227/files
Please reload this pagehttps://github.com/python/cpython/pull/104227/commits/b7fb7a47071bb85c054576d6e0cb17b6622505e2
gh-104223: Fix issues with inheriting from buffer classes https://github.com/python/cpython/pull/104227/commits/b7fb7a47071bb85c054576d6e0cb17b6622505e2#top
Show all changes 14 commits https://github.com/python/cpython/pull/104227/files
b7fb7a4 Fix buffer classes using super() JelleZijlstra May 6, 2023 https://github.com/python/cpython/pull/104227/commits/b7fb7a47071bb85c054576d6e0cb17b6622505e2
c717784 Fix bf_releasebuffer in child classes JelleZijlstra May 6, 2023 https://github.com/python/cpython/pull/104227/commits/c717784f82d4eab23f7bd44217553b9989619806
9fcb214 Merge branch 'main' into pep688fix JelleZijlstra May 6, 2023 https://github.com/python/cpython/pull/104227/commits/9fcb214707918eb45066ab575194688afcd136ca
88ce24d Add a test JelleZijlstra May 6, 2023 https://github.com/python/cpython/pull/104227/commits/88ce24da3d15e86177cb6e710331382a21b28960
80a4b0b Deal with __release_buffer__ saving references to the buffer JelleZijlstra May 7, 2023 https://github.com/python/cpython/pull/104227/commits/80a4b0b9b3dc7c3bc440272c2079f17e032da64a
6e31664 Add another test JelleZijlstra May 7, 2023 https://github.com/python/cpython/pull/104227/commits/6e316646293f6e1344470ea50089ff45c48a3d43
b73e29c More paranoid bufferwrapper_releasebuf JelleZijlstra May 7, 2023 https://github.com/python/cpython/pull/104227/commits/b73e29c6cb78d16c4a5e76ee3368eb4d62dd050c
15ad02d that did not work JelleZijlstra May 7, 2023 https://github.com/python/cpython/pull/104227/commits/15ad02d889fc7781d5efc309eb9287f2e035a806
9ded873 Update Objects/typeobject.c JelleZijlstra May 7, 2023 https://github.com/python/cpython/pull/104227/commits/9ded8731ff27c227ba73ed6edbb7508d49e9048a
3b50138 Update Objects/typeobject.c JelleZijlstra May 7, 2023 https://github.com/python/cpython/pull/104227/commits/3b50138960f77d6a52a1623fe5bfeee934191bfc
056efee Merge remote-tracking branch 'upstream/main' into pep688fix JelleZijlstra May 7, 2023 https://github.com/python/cpython/pull/104227/commits/056efee6292af1a1139b75a9b17bb288cf631fd7
9ee8eb5 Better message for new flag JelleZijlstra May 7, 2023 https://github.com/python/cpython/pull/104227/commits/9ee8eb5d59425416bc68cc7dd3d9a4291cbe3cb1
5536853 More tests JelleZijlstra May 7, 2023 https://github.com/python/cpython/pull/104227/commits/5536853ed0f11c7e5bb38163af53e16e51432dc9
02d7b9c Merge branch 'main' into pep688fix JelleZijlstra May 8, 2023 https://github.com/python/cpython/pull/104227/commits/02d7b9c0143d07ef4df22643ec8b80a3d2e4e580
Clear filters https://github.com/python/cpython/pull/104227/commits/b7fb7a47071bb85c054576d6e0cb17b6622505e2
Please reload this pagehttps://github.com/python/cpython/pull/104227/commits/b7fb7a47071bb85c054576d6e0cb17b6622505e2
Please reload this pagehttps://github.com/python/cpython/pull/104227/commits/b7fb7a47071bb85c054576d6e0cb17b6622505e2
pycore_memoryobject.h https://github.com/python/cpython/pull/104227/commits/b7fb7a47071bb85c054576d6e0cb17b6622505e2#diff-111730a458b7b448053f9942d4f189dba4d7c357a287fd4c7deff31c8cff8215
test_buffer.py https://github.com/python/cpython/pull/104227/commits/b7fb7a47071bb85c054576d6e0cb17b6622505e2#diff-ccd9f4a5ebfeaa46497d8bb31b8cf32a1f73a7e127474770a659124beaa815ff
bytearrayobject.c https://github.com/python/cpython/pull/104227/commits/b7fb7a47071bb85c054576d6e0cb17b6622505e2#diff-6878f29bbfb711dc7cd2a89b2b2941b1f900b6367d30181a2ff45460b591b04c
memoryobject.c https://github.com/python/cpython/pull/104227/commits/b7fb7a47071bb85c054576d6e0cb17b6622505e2#diff-7d1cb11da20dc3738b65b0f7381bf02df53132562a9749ba8a22d67a0f05f106
typeobject.c https://github.com/python/cpython/pull/104227/commits/b7fb7a47071bb85c054576d6e0cb17b6622505e2#diff-1decebeef15f4e0b0ce106c665751ec55068d4d1d1825847925ad4f528b5b872
Next https://github.com/python/cpython/pull/104227/commits/c717784f82d4eab23f7bd44217553b9989619806
Please reload this pagehttps://github.com/python/cpython/pull/104227/commits/b7fb7a47071bb85c054576d6e0cb17b6622505e2
https://github.com/JelleZijlstra
JelleZijlstrahttps://github.com/python/cpython/commits?author=JelleZijlstra
Include/internal/pycore_memoryobject.hhttps://github.com/python/cpython/pull/104227/commits/b7fb7a47071bb85c054576d6e0cb17b6622505e2#diff-111730a458b7b448053f9942d4f189dba4d7c357a287fd4c7deff31c8cff8215
View file https://github.com/JelleZijlstra/cpython/blob/b7fb7a47071bb85c054576d6e0cb17b6622505e2/Include/internal/pycore_memoryobject.h
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/104227/commits/{{ revealButtonHref }}
https://github.com/python/cpython/pull/104227/commits/b7fb7a47071bb85c054576d6e0cb17b6622505e2#diff-111730a458b7b448053f9942d4f189dba4d7c357a287fd4c7deff31c8cff8215
https://github.com/python/cpython/pull/104227/commits/b7fb7a47071bb85c054576d6e0cb17b6622505e2#diff-111730a458b7b448053f9942d4f189dba4d7c357a287fd4c7deff31c8cff8215
Lib/test/test_buffer.pyhttps://github.com/python/cpython/pull/104227/commits/b7fb7a47071bb85c054576d6e0cb17b6622505e2#diff-ccd9f4a5ebfeaa46497d8bb31b8cf32a1f73a7e127474770a659124beaa815ff
View file https://github.com/JelleZijlstra/cpython/blob/b7fb7a47071bb85c054576d6e0cb17b6622505e2/Lib/test/test_buffer.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/104227/commits/{{ revealButtonHref }}
https://github.com/python/cpython/pull/104227/commits/b7fb7a47071bb85c054576d6e0cb17b6622505e2#diff-ccd9f4a5ebfeaa46497d8bb31b8cf32a1f73a7e127474770a659124beaa815ff
Objects/bytearrayobject.chttps://github.com/python/cpython/pull/104227/commits/b7fb7a47071bb85c054576d6e0cb17b6622505e2#diff-6878f29bbfb711dc7cd2a89b2b2941b1f900b6367d30181a2ff45460b591b04c
View file https://github.com/JelleZijlstra/cpython/blob/b7fb7a47071bb85c054576d6e0cb17b6622505e2/Objects/bytearrayobject.c
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/104227/commits/{{ revealButtonHref }}
https://github.com/python/cpython/pull/104227/commits/b7fb7a47071bb85c054576d6e0cb17b6622505e2#diff-6878f29bbfb711dc7cd2a89b2b2941b1f900b6367d30181a2ff45460b591b04c
https://github.com/python/cpython/pull/104227/commits/b7fb7a47071bb85c054576d6e0cb17b6622505e2#diff-6878f29bbfb711dc7cd2a89b2b2941b1f900b6367d30181a2ff45460b591b04c
Objects/memoryobject.chttps://github.com/python/cpython/pull/104227/commits/b7fb7a47071bb85c054576d6e0cb17b6622505e2#diff-7d1cb11da20dc3738b65b0f7381bf02df53132562a9749ba8a22d67a0f05f106
View file https://github.com/JelleZijlstra/cpython/blob/b7fb7a47071bb85c054576d6e0cb17b6622505e2/Objects/memoryobject.c
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/104227/commits/{{ revealButtonHref }}
https://github.com/python/cpython/pull/104227/commits/b7fb7a47071bb85c054576d6e0cb17b6622505e2#diff-7d1cb11da20dc3738b65b0f7381bf02df53132562a9749ba8a22d67a0f05f106
https://github.com/python/cpython/pull/104227/commits/b7fb7a47071bb85c054576d6e0cb17b6622505e2#diff-7d1cb11da20dc3738b65b0f7381bf02df53132562a9749ba8a22d67a0f05f106
https://github.com/python/cpython/pull/104227/commits/b7fb7a47071bb85c054576d6e0cb17b6622505e2#diff-7d1cb11da20dc3738b65b0f7381bf02df53132562a9749ba8a22d67a0f05f106
https://github.com/python/cpython/blob/main/.github/CODEOWNERS#L217
Objects/typeobject.chttps://github.com/python/cpython/pull/104227/commits/b7fb7a47071bb85c054576d6e0cb17b6622505e2#diff-1decebeef15f4e0b0ce106c665751ec55068d4d1d1825847925ad4f528b5b872
View file https://github.com/JelleZijlstra/cpython/blob/b7fb7a47071bb85c054576d6e0cb17b6622505e2/Objects/typeobject.c
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/cpython/pull/104227/commits/{{ revealButtonHref }}
https://github.com/python/cpython/pull/104227/commits/b7fb7a47071bb85c054576d6e0cb17b6622505e2#diff-1decebeef15f4e0b0ce106c665751ec55068d4d1d1825847925ad4f528b5b872
https://github.com/python/cpython/pull/104227/commits/b7fb7a47071bb85c054576d6e0cb17b6622505e2#diff-1decebeef15f4e0b0ce106c665751ec55068d4d1d1825847925ad4f528b5b872
https://github.com/python/cpython/pull/104227/commits/b7fb7a47071bb85c054576d6e0cb17b6622505e2#diff-1decebeef15f4e0b0ce106c665751ec55068d4d1d1825847925ad4f528b5b872
https://github.com/python/cpython/pull/104227/commits/b7fb7a47071bb85c054576d6e0cb17b6622505e2#diff-1decebeef15f4e0b0ce106c665751ec55068d4d1d1825847925ad4f528b5b872
https://github.com/python/cpython/pull/104227/commits/b7fb7a47071bb85c054576d6e0cb17b6622505e2#diff-1decebeef15f4e0b0ce106c665751ec55068d4d1d1825847925ad4f528b5b872
https://github.com/python/cpython/pull/104227/commits/b7fb7a47071bb85c054576d6e0cb17b6622505e2#diff-1decebeef15f4e0b0ce106c665751ec55068d4d1d1825847925ad4f528b5b872
https://github.com/python/cpython/pull/104227/commits/b7fb7a47071bb85c054576d6e0cb17b6622505e2#diff-1decebeef15f4e0b0ce106c665751ec55068d4d1d1825847925ad4f528b5b872
https://github.com/python/cpython/pull/104227/commits/b7fb7a47071bb85c054576d6e0cb17b6622505e2#diff-1decebeef15f4e0b0ce106c665751ec55068d4d1d1825847925ad4f528b5b872
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.