Title: Align itertools constructor binding and conversions by youknowdot · Pull Request #9632 · RustPython/RustPython · GitHub
Open Graph Title: Align itertools constructor binding and conversions by youknowdot · Pull Request #9632 · RustPython/RustPython
X Title: Align itertools constructor binding and conversions by youknowdot · Pull Request #9632 · RustPython/RustPython
Description: Summary Align itertools constructor binding and conversion order with CPython while preserving positional/keyword kinds and subclass keyword handling. Bind tee's optional count before invoking __index__. Build on merged #9513: keep typed PyIter arguments for cycle, starmap, takewhile, dropwhile, filterfalse, and pairwise, whose positional arity and keyword checks now happen before conversion. Retain deferred conversion where ordering or source lifetime requires it. In particular, _tee must keep its source alive until copying an existing tee's position. Align batched signed-size conversion, strict truth testing, partial-batch and source-error behavior, and islice start/stop/step conversion ordering and ValueErrors. Validate combinations sizes before consuming the iterable, preserve permutations' distinct pool-first/PyLong-only semantics, and distinguish an omitted repeat count from explicit None. Share the C-ssize conversion for relevant counts and retain user conversion exceptions. Add focused regression coverage for argument rejection before __iter__, direct __new__ calls, subclass keywords, and _tee source finalization. Resolve the related Clippy warnings. Validation cargo test --locked -p rustpython-vm --lib: 170 passed. Threading-enabled RustPython debug build with stdlib,stdio,importlib,host_env,doc,threading; rustpython -m test test_itertools: SUCCESS, 137 run, 22 skipped. pytest -v test_snippets.py -k stdlib_itertools: 2 passed (RustPython and CPython 3.12.14). Targeted VM Clippy with compiler,gc,host_env,stdio,doc,threading,importlib,encodings: passed without warnings. Normal commit hooks, including rustfmt, cspell, and Ruff: passed. Full workspace/C-API suites and release-mode tests have not completed. The first non-threading build failed the concurrent tee test; rerunning the full module with threading enabled passed. This does not claim complete constructor parity. Existing arity-versus-keyword diagnostic precedence, other allocation and argument/source lifetime differences, try_index normalization details, and broader concurrency behavior remain outside scope. Deferred conversion retains the original argument during the constructor call and adds bounded reference-management work; no benchmark was run. zip_longest variadic binding remains unchanged because deferring it requires a separately assessed temporary allocation. AI assistance OpenAI Codex assisted with implementation, source review, regression tests, and local validation.
Open Graph Description: Summary Align itertools constructor binding and conversion order with CPython while preserving positional/keyword kinds and subclass keyword handling. Bind tee's optional count before invoking...
X Description: Summary Align itertools constructor binding and conversion order with CPython while preserving positional/keyword kinds and subclass keyword handling. Bind tee's optional count before invo...
Opengraph URL: https://github.com/RustPython/RustPython/pull/9632
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:ac64fb2e-5dac-28b9-2fd1-21a58b66d23a |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | 86FA:3A8E64:138FE5B:19EE1F2:6B01F396 |
| html-safe-nonce | ca7cc83c5121f1c70fdbc2e622e5e76796494b92bfb80db6da2a5eb0653ff61b |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4NkZBOjNBOEU2NDoxMzhGRTVCOjE5RUUxRjI6NkIwMUYzOTYiLCJ2aXNpdG9yX2lkIjoiNjk1ODIwNTQ1MzUxNjAxMDM5MCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 841bc6fee9c0ba7bd8c482972f1740ad0e11006db125b82c72aae97b2214199e |
| hovercard-subject-tag | pull_request:5139665404 |
| 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/9632/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 itertools constructor binding and conversion order with CPython while preserving positional/keyword kinds and subclass keyword handling. Bind tee's optional count before invoking... |
| 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