Title: Align range search, argument and iterator controls by youknowdot · Pull Request #9695 · RustPython/RustPython · GitHub
Open Graph Title: Align range search, argument and iterator controls by youknowdot · Pull Request #9695 · RustPython/RustPython
X Title: Align range search, argument and iterator controls by youknowdot · Pull Request #9695 · RustPython/RustPython
Description: Summary Align native range search, argument, subscription, and iterator controls with CPython 3.15 in 340 substantive changed production lines (+155/-185): Reuse shared sequence count/index and the extracted iteration-only contains fallback, preserving element-first equality, actual match positions, and callback exceptions. Share the exact-int/bool fast path. Other int subclasses keep equality callbacks; bool containment no longer iterates an enormous range. Bind constructor objects with the existing tuple binder, then convert start, stop, and step through the shared delayed ArgIndex converter while retaining the originals. Preserve subscription conversion exceptions and invalid-return diagnostics. Share forward/reverse iterator construction and select compact iterators using platform C-long bounds, including exhausted endpoints and reverse overflow boundaries. Advance iterator state relative to the remaining range without reviving exhaustion. Fast state uses shared ArgIndex and C-long overflow checks; long state requires exact ints. Preserve reentrant conversion and cleanup order. No Python, Lib, test, marker, or workflow edits. Existing atomic iterator storage, fast_next specialization, and reduction snapshots are unchanged. Validation Compared against pinned CPython range source and shared sequence search. Original search/control group: 12,664 CPython/reference-model assertions passed, with independent callback, finalizer, error, and enormous-bool checks. Iterator increment: 142,161 CPython/source-model assertions and 36,608 additional independent assertions passed. Coverage includes 32/64-bit C-long boundary models, actual 64-bit forward/reverse selection, sequential state advancement, exhaustion, pickle round trips, conversion callbacks and original-state finalizers. Final cleanup correction also passed 30 lifecycle assertions and independent refcount-order review. Independent exact-source review passed for the full composition and final two-line cleanup correction. These oracle/model checks do not execute the Rust implementation. Focused host-env/VM/stdlib threading cargo check, normal all-targets Clippy, formatting, diff checks, and ordinary commit hooks passed. Four Clippy diagnostics exactly match unchanged main baseline: one POSIX needless-collect and three ElementTree lints. Strict -D warnings remains blocked by that baseline; nothing was suppressed. Native RustPython execution was not performed because the required execution guard has not been verified. Full workspace/C-API suites and cross-platform runtime tests were not run. Hosted CI remains required; Windows and 32-bit iterator checks are source/model validation only. Remaining limits The shared binder retains its unexpected-keyword diagnostic rather than Clinic's blanket keyword error. Shared sequence search retains theoretical signed-size overflow differences for enormous fallback searches. UTF-8 type names truncate on a character boundary within 200 bytes. Range slicing remains unchanged. Existing range-test crash skips remain intact and are not claimed resolved. AI-assisted implementation and independent review using OpenAI Codex; assistance is disclosed in commit trailers. Summary by CodeRabbit Bug Fixes Range construction now converts arguments in order and consistently handles omitted values and zero steps. Range membership, index, and count now respect custom equality behavior for integer subclasses. Range iteration supports large values when compact iteration cannot safely represent them. Restoring iterator state now advances from the current position, with advances bounded by the remaining items. Invalid range-index values produce clearer type errors.
Open Graph Description: Summary Align native range search, argument, subscription, and iterator controls with CPython 3.15 in 340 substantive changed production lines (+155/-185): Reuse shared sequence count/index and th...
X Description: Summary Align native range search, argument, subscription, and iterator controls with CPython 3.15 in 340 substantive changed production lines (+155/-185): Reuse shared sequence count/index and th...
Opengraph URL: https://github.com/RustPython/RustPython/pull/9695
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:f7695125-9635-a952-44ed-5bbb609df2e2 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | 9604:2E3FEE:3A1421C:498D8E1:6B01F683 |
| html-safe-nonce | 3d89a1c26c3e5402a1164979cac4ece7a33a2443a2d4421fb2a731a1ff18c32f |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5NjA0OjJFM0ZFRTozQTE0MjFDOjQ5OEQ4RTE6NkIwMUY2ODMiLCJ2aXNpdG9yX2lkIjoiNzg2MDczMzAwMDg1MzcyNTQ3IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 99fd14805c4f52a1511d285fedd01b945459f6a9b308a51a89b44fd9a4e1c8d9 |
| hovercard-subject-tag | pull_request:5152257085 |
| 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/9695/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 native range search, argument, subscription, and iterator controls with CPython 3.15 in 340 substantive changed production lines (+155/-185): Reuse shared sequence count/index and th... |
| 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