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 list, tuple and slice controls by youknowdot · Pull Request #9696 · RustPython/RustPython

Conversation

@youknowdot

@youknowdot youknowdot commented Nov 4, 2026 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor

Summary

Group related CPython 3.15 list/tuple/slice search and comparison fixes in 534 changed lines across eight production Rust files:

  • Reuse the shared slice-index conversion for list/tuple index bounds, saturate oversized integers, convert both bounds before reading the current list length, and allow searches to reach elements appended by callbacks.

  • Retain raw bounds through conversion/search and release them in argument order through one shared owner, rather than writing method-specific argument parsers.

  • Use CPython's constant list.index/list.remove missing-value errors without invoking user formatting callbacks.

  • Preserve raw ordering results and exact comparison operators for lists, tuples and structseqs; compare tuple prefixes even when lengths differ.

  • Reuse the same raw-result comparison helper for slice components, preserve the same-slice shortcut, and retain the raw length through indices conversions and cleanup. Correct slice-specific conversion diagnostics and constructor keyword priority.

  • Release list element roots before observing callback mutations, then reload the first unequal pair for ordering. Preserve the existing constant-time identical-object equality shortcut.

  • Release detached list children in reverse and clear slice fields in step/start/stop order before freelisting, without retaining the old stop owner in a cached husk.

  • Preserve list.sort cleanup on key or comparison failure: reverse partial-key destruction, restore the current value permutation, restore the live list before reverse-releasing callback-added items, and preserve the original error over a mutation error.

  • Use initial/final reversal around the existing stable forward sort for reverse=True, releasing keys before the final value reversal even on failure.

  • Release each temporary repr result before the next callback. Slice repr reuses the corrected collection formatter also used by tuple/set/deque.

Reference and validation

Compared against CPython source commit d220409a13b77de7a6c30abe16ea90db01528edc and a verified CPython 3.15 oracle. 10,438 reference/model assertions and 82 additional independent oracle assertions passed, including mutation, finalizer order, argument conversion, descriptors, oversized bounds, and nonboolean comparison results. These are CPython/source-model checks, not execution of the Rust implementation.

Independent source review passed for the original six-file composition and the subsequent slice extension. Ordinary commit hooks passed. Focused host-env/VM/stdlib threading cargo check and normal all-targets Clippy passed on the final source. The final slice composition also exposes eight unchanged host_env/socket diagnostics in addition to the earlier four baseline diagnostics (one POSIX needless-collect and three ElementTree lints); no candidate-file warnings remain. Strict -D warnings is not clean because of that baseline; no warnings were suppressed. The compiler caught an owning-versus-borrowed method-resolution error before publication; the one-line explicit borrowed call was independently re-reviewed, normally committed, and rechecked.

The slice extension additionally passed 6,884 CPython/source-model assertions and 109 independent CPython assertions. These reference checks do not claim RustPython runtime coverage.

No Python, Lib, tests, markers or workflows are changed. This does not remove existing expected failures or claim they have passed.

The lifecycle extension additionally passed 59 focused CPython assertions, 40 teardown/structseq controls and 90 independent reference assertions. These include explicit negative controls for deferred behavior, not claims that every probed behavior is fixed. Independent source review passed on the final three-file extension. The first check caught a missing formatter import; it was corrected before the final validation rerun. The final lifecycle source passed threaded cargo check in 1m00s and all-targets Clippy in 2m17s. That exact branch produced the four unchanged POSIX/ElementTree diagnostics, matching the recorded four-warning baseline; the later-main socket diagnostics are absent on this branch. No warnings were suppressed.

Limits and integration

Native RustPython execution was not performed because the required execution guard has not been verified. Full workspace/C-API tests and cross-platform runtime checks remain unrun; hosted CI is pending. Separately locked cross-thread snapshots and malformed-call cleanup before shared bound binding remain inherited limitations. slice.indices retains its inherited shared-binder arity/keyword wording and precedence; typed raw arguments preserve signature metadata and prevent conversion before binding without adding a method-specific parser.

Old infrastructure PRs #8966, #8944, #8939 and #8848, plus metadata PR #9551, touch some of these files but do not implement these behavior fixes. Their eventual composition may require textual reconciliation. The changed public Rust helper/trait interfaces may also affect out-of-tree consumers; all in-tree consumers were checked.

Generic tuple child teardown remains unchanged: structseq shares the Rust tuple payload but CPython destroys its fields forward, unlike ordinary tuples. Tuple-construction allocation-boundary cleanup, subclass dictionary/slot-before-payload teardown, sort mutation-counter false positives for no-op mutations, and algorithm-specific comparison traces or exact failure permutations remain outside this patch. The existing sorting algorithm is not replaced. Old algorithm PR #6096 must preserve these driver/lifecycle controls when composed. The GC designs in #8939/#8944 retain clear-return, edge destruction, then freelist insertion; no core GC rewrite is included.

AI-assisted contribution by OpenAI Codex; assistance is disclosed in the commit trailer.

Sorry, something went wrong.

Uh oh!

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

All reactions
youknowdot added 2 commits November 4, 2026 19:14
@youknowdot
Align list and tuple search and comparison controls
261df94
Reuse shared bounds conversion, retain callback results and argument lifetimes, and preserve constant-time identity comparisons.

Assisted-by: OpenAI Codex:model version not exposed
@youknowdot
Select borrowed list element comparison explicitly
3eead41
Avoid the consuming PyObjectRef overload so existing element roots remain alive until explicit left-to-right cleanup.

Assisted-by: OpenAI Codex:model version not exposed
@coderabbitai

coderabbitai Bot commented Nov 4, 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 native sequence iterator state and lifecycle #9701
Merged
@youknowdot
Reuse sequence comparison controls for slices
a1f6640
Retain raw indices length through all component conversions, preserve raw comparison results, and match slice conversion diagnostics.

Assisted-by: OpenAI Codex:model version not exposed
@youknowdot youknowdot changed the title Align list and tuple search and comparison controls Align list, tuple and slice controls Nov 4, 2026
@youknowdot
Align sequence cleanup and sorting callback lifetimes
64583eb
Release detached list and slice owners in CPython order, preserve sort cleanup and reverse-driver semantics, and share immediate repr-result disposal.

Assisted-by: OpenAI Codex:model version not exposed
youknowone
youknowone reviewed Nov 5, 2026
View reviewed changes
Comment thread crates/vm/src/builtins/list.rs Outdated
)]
impl Py<PyList> {
#[pyslot]
fn slot_richcompare(

@youknowone youknowone Nov 5, 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.

why Comparable is replaced to this one? any reason?

Sorry, something went wrong.

Uh oh!

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

All reactions
youknowdot added 2 commits November 5, 2026 11:48
@youknowdot
Retain Comparable for sequence rich comparisons
05e6b00
Override the existing rich comparison slot through Comparable while retaining its bool-valued cmp adapter. Preserve arbitrary Python ordering results without duplicating sequence comparison logic.

Assisted-by: OpenAI Codex:model version not exposed
@youknowdot
Use Self in Comparable slot implementations
dd19e8e
Follow the trait implementation lint after moving sequence rich comparison slots.

Assisted-by: OpenAI Codex:model version not exposed
@youknowone
youknowone marked this pull request as ready for review November 6, 2026 12:36
@youknowone
youknowone merged commit 22ee0b0 into RustPython:main Nov 6, 2026
24 of 28 checks passed

Uh oh!

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

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 6, 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 left review comments

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.