Title: Serialize bytearray exports with resizing by youknowdot · Pull Request #9087 · RustPython/RustPython · GitHub
Open Graph Title: Serialize bytearray exports with resizing by youknowdot · Pull Request #9087 · RustPython/RustPython
X Title: Serialize bytearray exports with resizing by youknowdot · Pull Request #9087 · RustPython/RustPython
Description: Summary Fix a main-common bytearray buffer race surfaced by #8951 macOS CI: decoding used a buffer descriptor of 4 MiB after the underlying bytearray had been cleared. Keep the bytearray read lock through descriptor creation and export retention; preserve early export rejection and recheck exports after acquiring the resize lock. Route initializer replacement and sequence-slot deletion through the resize guard. Clear before initializer conversion, while preserving the successful zero-index callback's no-write behavior without calling __index__ twice. Make RawIOBase.read validate the count, perform a guarded resize, and take the temporary buffer, following pinned CPython 3.15.0 source and preserving retained-view errors. Add bounded Python export-lifetime and concurrent decode/memoryview regressions. No Lib/ files or existing assertions are changed. Base: f39da82d9d38cd5bdceb9e645205e830f65126fb. Head: d0819a2fabf2017c5603e089acc7c3a22020f241. Validation Independent source review of lock ordering, callback/reentry boundaries, retain/release ownership, and each changed mutation path. Native default-feature debug build and cargo check passed; root and matching-feature VM-library Clippy passed with -D warnings; normal commit hooks passed. Both new snippets and existing builtin_bytearray.py / builtin_bytes.py passed on the exact stamped candidate, each in a timeout-controlled subprocess. The unchanged current-main test_bytes.FreeThreadingTest.test_free_threading_bytearray passed once in an isolated subprocess. Its body predates final CPython's additional take_bytes cases; this is validation of the failing CI method, not full final-bytearray API coverage. Both new snippets passed on certified CPython 3.15.0 (d220409a13b77de7a6c30abe16ea90db01528edc). Constructor and raw-I/O error/order semantics were checked against that source. A qualified pre-fix #8951 native binary with source-identical affected runtime files fails the new exported-initializer regression. Local contention and canonical race runs passed on the baseline too; the actual race-before evidence is the hosted macOS panic and source interleavings, not a claimed deterministic local reproduction. Candidate executable stamp, own embedded standard-library path, imported module origins, and artifact hashes were verified. Full workspace/C-API suites, release validation and non-Linux runtime coverage were not run locally. Existing incremental-iterable constructor differences, the public Rust mutable-vector API boundary and final take_bytes API additions remain outside this repair. The sequence-slot deletion change has source review rather than direct C-API runtime coverage. Keep this PR draft and unmerged pending hosted CI and maintainer review. AI assistance OpenAI Codex implemented, reviewed and validated this change under maintainer direction. The exact model identifier is unavailable in this environment; the commit includes an Assisted-by trailer. This draft does not claim completed human validation. Summary by CodeRabbit Bug Fixes Improved bytearray behavior when buffers are actively exported or modified during operations, including searching, comparisons, translation, padding, initialization, and deletion. Improved handling of temporary buffers during reads, including resizing and allocation failures. Tests Added coverage for bytearray exports, callbacks, and concurrent resizing.
Open Graph Description: Summary Fix a main-common bytearray buffer race surfaced by #8951 macOS CI: decoding used a buffer descriptor of 4 MiB after the underlying bytearray had been cleared. Keep the bytearray read lock...
X Description: Summary Fix a main-common bytearray buffer race surfaced by #8951 macOS CI: decoding used a buffer descriptor of 4 MiB after the underlying bytearray had been cleared. Keep the bytearray read lock...
Opengraph URL: https://github.com/RustPython/RustPython/pull/9087
X: @github
Domain: github.com
| react-profiling | 0 |
| react-import-map | react,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-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:3552e847-59c9-544b-7fee-e3e206ffdcd0 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | E8DC:21BD98:3333868:40E87FB:6B020B9F |
| html-safe-nonce | a3789f36785379cca55606f23554cce5f12e708a8ddea7c664e1082b34547671 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFOERDOjIxQkQ5ODozMzMzODY4OjQwRTg3RkI6NkIwMjBCOUYiLCJ2aXNpdG9yX2lkIjoiNjcxMDIwNzc5Njk2MjUyODE1OSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | ccb5ace875a55f5884f88d12d929a8c6573b5c3726bce0cb23d18f94d103b7f7 |
| hovercard-subject-tag | pull_request:4822211812 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/RustPython/RustPython/pull/9087/files |
| twitter:image | https://avatars.githubusercontent.com/u/336763669?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/336763669?s=400&v=4 |
| og:image:alt | Summary Fix a main-common bytearray buffer race surfaced by #8951 macOS CI: decoding used a buffer descriptor of 4 MiB after the underlying bytearray had been cleared. Keep the bytearray read lock... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/RustPython/RustPython git https://github.com/RustPython/RustPython.git |
| octolytics-dimension-user_id | 39710557 |
| octolytics-dimension-user_login | RustPython |
| octolytics-dimension-repository_id | 135201145 |
| octolytics-dimension-repository_nwo | RustPython/RustPython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 135201145 |
| octolytics-dimension-repository_network_root_nwo | RustPython/RustPython |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 423dbb54c5e7bfecc838eb387c1435eb3d0e760d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width