Title: Align memoryview scalar, cast, and indexing controls by youknowdot · Pull Request #9692 · RustPython/RustPython · GitHub
Open Graph Title: Align memoryview scalar, cast, and indexing controls by youknowdot · Pull Request #9692 · RustPython/RustPython
X Title: Align memoryview scalar, cast, and indexing controls by youknowdot · Pull Request #9692 · RustPython/RustPython
Description: Summary Align memoryview scalar formats, casts, indexing, assignment and comparison with CPython 3.15. Rebased onto main 22ee0b0380 through #9563 (a5d24851a5e94c81770935e6578c6081fda10705), retaining its strict shared Clinic binding and string conversion. Keep a small native memoryview scalar adapter, as CPython does, while sharing the binary format types, unpack functions, numeric converters and existing struct format cache. Text formatting for str/bytes has a different grammar and is not used for binary layouts. Use allocation-free native equality and fixed-size scalar write buffers. Borrow conversion inputs and existing memoryview descriptors instead of cloning objects or allocating a Vec per scalar write. Retain temporary arguments until the operation finishes, including their observable finalizers. Make the shared struct parser strict rather than maintaining a second comparison grammar. Match whitespace, repeat-count, NUL and native-only format validation. Share bit-exact half conversion and preserve half/complex signaling-NaN behavior. Match cast and index conversion/error ordering, saturated slice bounds, reflected comparison, tuple indexing, iterator state and overlapping assignment. Propagate multidimensional comparison failures and permit shared immutable buffer reads without recursive mutex deadlocks. Remove obsolete packing error wrappers. Add focused Rust and snippet regressions without changing existing test assertions. The included #9563 revision removes only two obsolete SQLite expected-failure decorators. Reference: CPython 3.15 memoryobject.c, struct and float packing. CI failure and rebase The previous head failed the CPython suites on Linux, macOS and Windows only because two SQLite tests unexpectedly passed while still marked expectedFailure: test_set_progress_handler_keyword_args and test_func_keyword_args. The inherited binder fixed their behavior; #9563 retires those two obsolete decorators. Memoryview and struct passed on all three OSes. The rebase preserves main's new staged CSV parser and list/tuple/slice behavior. Its shared unnamed duplicate-argument diagnostic now omits parentheses, matching CPython, without restoring parser opt-outs. Saturating index conversion is shared with the new sequence helper while preserving temporary argument lifetimes. Validation Verified locally on Linux x86_64 with CPython 3.15.0 as the reference: Release RustPython build passed with stdlib,stdio,importlib,host_env,doc,threading,sqlite and no default features. Strict workspace and separate C-API Clippy passed with -D warnings. All changed-file hooks and formatting checks passed. Ten focused snippets passed, including memoryview, argument errors, CSV, list, tuple and slice. The slice snippet ran through its normal fixture-generating pytest harness. All 698 behavioral differential cases matched CPython exactly. Relevant stdlib suites, including SQLite, CSV, memoryview, struct, list, tuple, slice and index: 3,451 tests run, 242 skipped; all 23 test files passed. CPython-only half-precision reference checks passed 255,994 assertions. Rust unit tests independently cover every half encoding and finite half rounding boundary. Full extra_tests pytest: 487 passed, 19 failed, 15 subtests passed. Failures were restricted socket/chown operations (14) and optional SSL/legacy-Unicode features omitted from this profile (5). This is not a full-suite pass. Full workspace/C-API test reruns are still pending on this rebased head. The prior revision passed 1,507 workspace tests and 149 C-API tests; those results are not substituted for the final reruns. The release-after-index char assignment intentionally retains RustPython's safety check: when an index callback releases a cast('c') view, assignment raises ValueError rather than writing through the released view as CPython currently does. Fresh hosted CI remains required. No claim of complete memoryview compatibility or a measured speedup is made. AI-assisted implementation, testing and source review using OpenAI Codex; model version is not exposed.
Open Graph Description: Summary Align memoryview scalar formats, casts, indexing, assignment and comparison with CPython 3.15. Rebased onto main 22ee0b0380 through #9563 (a5d24851a5e94c81770935e6578c6081fda10705), retaini...
X Description: Summary Align memoryview scalar formats, casts, indexing, assignment and comparison with CPython 3.15. Rebased onto main 22ee0b0380 through #9563 (a5d24851a5e94c81770935e6578c6081fda10705), retaini...
Opengraph URL: https://github.com/RustPython/RustPython/pull/9692
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:5c0914c3-706c-9623-5911-a9b16e7e3607 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | E1AE:65478:347154D:459525E:6B01F382 |
| html-safe-nonce | 8878b4cb8dcd89a7b9c91dc136c276290147a59039fbd46a8456529baa8396b1 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFMUFFOjY1NDc4OjM0NzE1NEQ6NDU5NTI1RTo2QjAxRjM4MiIsInZpc2l0b3JfaWQiOiI0NzMwMjg2NTI1NTc5OTE2MTYyIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 6c7cd9a5f9702c951d54883e25b95c68d43e67dea88d4546875e54624e6f918c |
| hovercard-subject-tag | pull_request:5150940143 |
| 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/9692/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 Align memoryview scalar formats, casts, indexing, assignment and comparison with CPython 3.15. Rebased onto main 22ee0b0380 through #9563 (a5d24851a5e94c81770935e6578c6081fda10705), retaini... |
| 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