René's URL Explorer Experiment


Title: Allow same-size bytearray.resize with exported buffers by seungje0612 · Pull Request #9217 · RustPython/RustPython · GitHub

Open Graph Title: Allow same-size bytearray.resize with exported buffers by seungje0612 · Pull Request #9217 · RustPython/RustPython

X Title: Allow same-size bytearray.resize with exported buffers by seungje0612 · Pull Request #9217 · RustPython/RustPython

Description: I did not use AI to write the code of this patch. This PR follows our AI policy AI assistance: Codex:GPT-6 Summary Update bytearray.resize() in crates/vm/src/builtins/bytearray.rs to use resize_access(), allowing unchanged-size requests under exports while rejecting actual length changes and avoiding nested payload read locks. Remove the expected-failure/TODO marker from ByteArrayTest.test_resize_forbidden in Lib/test/test_bytes.py Add three regression tests to extra_tests/snippets/builtin_bytearray.py: test_bytearray_resize_exported_buffer: verify same-size success, rejection of length changes while a child view remains, and zero-filled growth after releasing all views. test_bytearray_resize_invalid_size: verify ValueError for negative sizes and TypeError for float arguments while exported, without modifying the buffer. test_bytearray_resize_codec_callback_with_waiting_writer: verify correct resize results and completion without deadlock during a codec error callback with a competing writer, using a subprocess timeout. Details ByteArrayTest.test_resize_forbidden fails at b.resize(10) when the bytearray already has length 10 and an active buffer export. Before this change, resize() calls try_resizable() and raises BufferError before comparing the requested size with the current length. CPython's implementation checks for an unchanged length before checking whether resizing is permitted. An unchanged-size request succeeds without modifying the buffer, even when exports are active. Match this behavior while continuing to reject actual length changes under an export. Use the existing resize_access() method to obtain either the stable exported length or exclusive payload access. This allows same-size resize requests to succeed under active exports without acquiring an additional payload read lock. In particular, it avoids introducing a potential deadlock when a codec error callback re-enters resize() while decoding holds a read guard and another thread is waiting for the write lock. Summary by CodeRabbit Bug Fixes Resizing a bytearray to its current length now succeeds while memory views are active; attempts to change its length continue to raise an error without altering the buffer. Resizing works again after memory views are released, and invalid sizes continue to produce the appropriate errors even when a view is active. Resizing from a codec error handler while another write is waiting no longer causes the writer to hang.

Open Graph Description: I did not use AI to write the code of this patch. This PR follows our AI policy AI assistance: Codex:GPT-6 Summary Update bytearray.resize() in crates/vm/src/builtins/bytearray.rs to use resiz...

X Description: I did not use AI to write the code of this patch. This PR follows our AI policy AI assistance: Codex:GPT-6 Summary Update bytearray.resize() in crates/vm/src/builtins/bytearray.rs to use resiz...

Opengraph URL: https://github.com/RustPython/RustPython/pull/9217

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:f5251bde-1ceb-717b-1f61-c8636ccc834d
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idD3BE:785A9:3BB8536:4BCB5C7:6B020370
html-safe-nonce7dd8ae7dd874a7c925a449f7fda4e3d6a9e73054d23c8fe52ed99c3481690003
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEM0JFOjc4NUE5OjNCQjg1MzY6NEJDQjVDNzo2QjAyMDM3MCIsInZpc2l0b3JfaWQiOiI0NTUzMzcxNzYzMTg2MjA1NTUyIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac50d0b823360c30ff3cdacb2013a7f79ee007f419790db1ecf6e5831df5d0f74a
hovercard-subject-tagpull_request:4922563055
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/RustPython/RustPython/pull/9217/files
twitter:imagehttps://avatars.githubusercontent.com/u/88067455?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/88067455?s=400&v=4
og:image:altI did not use AI to write the code of this patch. This PR follows our AI policy AI assistance: Codex:GPT-6 Summary Update bytearray.resize() in crates/vm/src/builtins/bytearray.rs to use resiz...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/RustPython/RustPython git https://github.com/RustPython/RustPython.git
octolytics-dimension-user_id39710557
octolytics-dimension-user_loginRustPython
octolytics-dimension-repository_id135201145
octolytics-dimension-repository_nwoRustPython/RustPython
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id135201145
octolytics-dimension-repository_network_root_nwoRustPython/RustPython
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/RustPython/RustPython/pull/9217/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FRustPython%2FRustPython%2Fpull%2F9217%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%2FRustPython%2FRustPython%2Fpull%2F9217%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=RustPython%2FRustPython
Reloadhttps://github.com/RustPython/RustPython/pull/9217/files
Reloadhttps://github.com/RustPython/RustPython/pull/9217/files
Reloadhttps://github.com/RustPython/RustPython/pull/9217/files
RustPythonhttps://github.com/RustPython
RustPythonhttps://github.com/RustPython/RustPython
Codehttps://github.com/RustPython/RustPython
Issues195 (195)https://github.com/RustPython/RustPython/issues
Pull requests133 (133)https://github.com/RustPython/RustPython/pulls
Discussionshttps://github.com/RustPython/RustPython/discussions
Actionshttps://github.com/RustPython/RustPython/actions
Projectshttps://github.com/RustPython/RustPython/projects
Wikihttps://github.com/RustPython/RustPython/wiki
Security and qualityhttps://github.com/RustPython/RustPython/security
Insightshttps://github.com/RustPython/RustPython/insights
Sign up for GitHub https://github.com/signup?return_to=%2FRustPython%2FRustPython%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2FRustPython%2FRustPython%2Fissues%2Fnew%2Fchoose
youknowonehttps://github.com/youknowone
RustPython:mainhttps://github.com/RustPython/RustPython/tree/main
seungje0612:fix-bytearray-resizehttps://github.com/seungje0612/RustPython/tree/fix-bytearray-resize
Conversation 7 https://github.com/RustPython/RustPython/pull/9217
Commits 2 https://github.com/RustPython/RustPython/pull/9217/commits
Checks 20 https://github.com/RustPython/RustPython/pull/9217/checks
Files changed https://github.com/RustPython/RustPython/pull/9217/files
Please reload this pagehttps://github.com/RustPython/RustPython/pull/9217/files
Allow same-size bytearray.resize with exported buffers https://github.com/RustPython/RustPython/pull/9217/files#top
Show all changes 2 commits https://github.com/RustPython/RustPython/pull/9217/files
8c4da2b Allow same-size bytearray.resize with exported buffers seungje0612 Oct 19, 2026 https://github.com/RustPython/RustPython/pull/9217/commits/8c4da2bc840a7dacd4b3db56e0a11ab4f5e53541
8756983 remove redundant tests seungje0612 Oct 19, 2026 https://github.com/RustPython/RustPython/pull/9217/commits/87569835f7070e83aa31a207bee864ed7057f25e
Clear filters https://github.com/RustPython/RustPython/pull/9217/files
Please reload this pagehttps://github.com/RustPython/RustPython/pull/9217/files
Please reload this pagehttps://github.com/RustPython/RustPython/pull/9217/files
test_bytes.py https://github.com/RustPython/RustPython/pull/9217/files#diff-58df2535f64e3dcfb0677a7f543924d976fd982b595f8e34902a73f3deae40eb
bytearray.rs https://github.com/RustPython/RustPython/pull/9217/files#diff-bd8962db12555ddc9945c543b57069611c9b3f24f133fbf3a76c7c60fe1cfddd
Lib/test/test_bytes.pyhttps://github.com/RustPython/RustPython/pull/9217/files#diff-58df2535f64e3dcfb0677a7f543924d976fd982b595f8e34902a73f3deae40eb
View file https://github.com/seungje0612/RustPython/blob/87569835f7070e83aa31a207bee864ed7057f25e/Lib/test/test_bytes.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/RustPython/RustPython/pull/9217/{{ revealButtonHref }}
https://github.com/RustPython/RustPython/pull/9217/files#diff-58df2535f64e3dcfb0677a7f543924d976fd982b595f8e34902a73f3deae40eb
https://github.com/RustPython/RustPython/pull/9217/files#diff-58df2535f64e3dcfb0677a7f543924d976fd982b595f8e34902a73f3deae40eb
crates/vm/src/builtins/bytearray.rshttps://github.com/RustPython/RustPython/pull/9217/files#diff-bd8962db12555ddc9945c543b57069611c9b3f24f133fbf3a76c7c60fe1cfddd
View file https://github.com/seungje0612/RustPython/blob/87569835f7070e83aa31a207bee864ed7057f25e/crates/vm/src/builtins/bytearray.rs
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/RustPython/RustPython/pull/9217/{{ revealButtonHref }}
https://github.com/RustPython/RustPython/pull/9217/files#diff-bd8962db12555ddc9945c543b57069611c9b3f24f133fbf3a76c7c60fe1cfddd
https://github.com/RustPython/RustPython/pull/9217/files#diff-bd8962db12555ddc9945c543b57069611c9b3f24f133fbf3a76c7c60fe1cfddd
Please reload this pagehttps://github.com/RustPython/RustPython/pull/9217/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.