GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Align itertools constructor binding and conversions by youknowdot · Pull Request #9632 · RustPython/RustPython

Conversation

@youknowdot

@youknowdot youknowdot commented Nov 3, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

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 Report a missing argument before converting any #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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@coderabbitai

coderabbitai Bot commented Nov 3, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Explain Change →

Caution

Review failed

The pull request is closed.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

  • X
  • Mastodon
  • Reddit
  • LinkedIn
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@youknowdot youknowdot mentioned this pull request Nov 4, 2026
Align itertools source and callback lifetimes #9721
Merged
youknowdot added 9 commits November 6, 2026 10:56
@youknowdot @codex
Align batched arguments and termination behavior
b60a1d0
Assisted-by: OpenAI Codex:model version not exposed
@youknowdot @codex
Align islice index conversion order
aed9a43
Assisted-by: OpenAI Codex:model version not exposed
@youknowdot @codex
Validate combinator sizes in CPython order
eea2a85
Assisted-by: OpenAI Codex:model version not exposed
@youknowdot @codex
Distinguish omitted repeat count from None
c740933
Assisted-by: OpenAI Codex:model version not exposed
@youknowdot @codex
Bind itertools arguments before conversions
61d03e1
Assisted-by: OpenAI Codex:model version not exposed
@youknowdot @codex
Match iterator count conversion diagnostics
a0f59c3
Assisted-by: OpenAI Codex:model version not exposed
@youknowdot @codex
Match repeat count overflow conversion
bf26e22
Assisted-by: OpenAI Codex:model version not exposed
@youknowdot @codex
Reuse the shared optional argument binder for islice
300b261
Bind the two required and two optional raw positional arguments together. Preserve explicit None values and deferred index conversion while removing the per-arity parsing branches.

Assisted-by: OpenAI Codex:model version not exposed
@youknowdot
Restore typed positional itertools arguments after binder validation
60e3d91
Use PyIter for cycle, starmap, takewhile, dropwhile, filterfalse, and pairwise now that positional arity and keyword checks precede conversion. Keep _tee source ownership through its position snapshot, and cover constructor callbacks, subclass keywords, and source finalization.

Use an islice step expression and gate the remaining int value helper to its test, serde, and JIT consumers to keep Clippy clean.

Assisted-by: OpenAI Codex:model version not exposed
@youknowdot
youknowdot force-pushed the fix/itertools-constructor-binding-20261103 branch from c756f0d to 60e3d91 Compare November 6, 2026 03:01
youknowone
youknowone reviewed Nov 6, 2026
View reviewed changes
Comment thread crates/vm/src/stdlib/itertools.rs
struct CompressNewArgs {
#[pyarg(any)]
data: PyIter,
data: PyObjectRef,

@youknowone youknowone Nov 6, 2026

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check this change is necessary after #9563

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
youknowone
youknowone approved these changes Nov 7, 2026
View reviewed changes
@youknowone
youknowone marked this pull request as ready for review November 7, 2026 11:57
@youknowone
youknowone merged commit 171879e into RustPython:main Nov 7, 2026
20 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 7, 2026

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-07T11:57:57.072635Z
We couldn’t complete this review. Comment @codex review to try again.
60e3d91 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 7, 2026

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@youknowone youknowone youknowone approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@youknowdot @youknowone
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.