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 object reduction and state callback controls by youknowdot · Pull Request #9716 · RustPython/RustPython

Conversation

@youknowdot

@youknowdot youknowdot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Summary

Align object reduction and state callback controls with Python 3.15 in one production Rust file (+186/-128).

  • Bind the reduction protocol through existing index conversion to a signed C int, preserving the original temporary argument through reducer dispatch and using CPython's range error.
  • Always perform dynamic __getstate__ lookup. Use the native default fast path only for the original implementation bound to the same receiver; retain instance overrides, foreign-bound methods, lookup errors and callback ownership.
  • Preserve original slot-name objects as state dictionary keys. Release temporary names and values before rechecking slot-list size, and avoid unchecked indexing if a callback/finalizer changed that list.
  • Propagate errors from newargs descriptors through the existing strict special-method lookup. Release returned outer tuples before validating their children, and preserve explicit argument/keyword cleanup on failures.
  • Capture the current class at the correct point after callbacks, helper lookup and empty-keyword destruction. Release class-level reducer temporaries before invoking the instance reducer, and keep top-level result/failure cleanup in source order.

Existing binding, lookup, dictionary and method primitives are reused. No per-function keyword parser, test, Lib or workflow edits are introduced.

Validation

Compared with pinned CPython object reduction/state. The 29-case reference oracle reproduced exactly. Independent source review and additional safe failure, copyreg, class-mutation, slot-finalizer and temporary-protocol probes passed. Ordinary classes/subclasses and legal class reassignment were used; no malformed native layouts or unsafe cycles were exercised.

These are CPython reference results and source review, not a RustPython runtime pass. Native RustPython execution, full workspace/C-API suites and separate cross-platform graphs remain unperformed; hosted CI is required.

Limits and integration

Generic nested tuple member destruction still differs from CPython's reverse order. This patch fixes the changed top-level owners but does not redesign generic tuple teardown or claim full nested-container finalizer parity.

Fresh relevant PR patches were checked and do not duplicate this group. Composing with #9715 requires resolving the object.rs import hunk by retaining both its PyAnyDict import and this patch's native-function/method-descriptor imports. The directory and reduction behavior hunks are separate; combined execution is not claimed. Preserve the independent ownership/type-name work in #8939/#8944/#9700 and nearby #8848 length-access changes.

AI-assisted implementation and independent review using OpenAI Codex; model version is not exposed.

Final validation: threaded host-env/VM/stdlib cargo check passed in 1m12s and all-targets Clippy in 3m03s. Diagnostics exactly match the 12 unchanged baseline warnings. Normal repository commit hooks passed; no suppressions or unrelated baseline edits.

Sorry, something went wrong.

Uh oh!

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

All reactions
@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.

youknowone
youknowone approved these changes Nov 6, 2026
View reviewed changes
@youknowdot @codex
Align object reduction and state callback controls
fad2db2
Preserve signed protocol arguments, dynamic state dispatch, original slot keys, and newargs ownership through shared lookup and conversion paths.

Assisted-by: OpenAI Codex:model version not exposed
@youknowdot
youknowdot force-pushed the fix/object-state-controls-20261104 branch from b522122 to fad2db2 Compare November 6, 2026 13:20
codex added 2 commits November 6, 2026 22:42
@codex
Rely on scope cleanup for redundant explicit drops
fad1c99
Preserve callback ownership, release ordering, and retained argument owners.

Assisted-by: Codex:model-version-unavailable
@codex
Simplify tail expressions after scope cleanup
2e35ed3
Assisted-by: Codex:model-version-unavailable
@youknowone
youknowone marked this pull request as ready for review November 6, 2026 23:46
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 6, 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-06T23:46:14.826637Z
We couldn’t complete this review. Comment @codex review to try again.
2e35ed3 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 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.

@youknowone
youknowone merged commit 6e606b3 into RustPython:main Nov 6, 2026
20 checks passed

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.

3 participants

@youknowdot @youknowone @codex
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.