⚡ Sangsakala Proxy 🏠 Home
Skip to content

Align partial construction and state controls - #9679

Draft
youknowdot wants to merge 3 commits into
RustPython:mainfrom
youknowdot:partial-state-controls-group-20261103
Draft

youknowdot wants to merge 3 commits into
RustPython:mainfrom
youknowdot:partial-state-controls-group-20261103

Conversation

@youknowdot

Copy link
Copy Markdown
Contributor

Summary

  • Keep nested partial keyword dictionaries isolated and flatten only partials whose instance dictionary remains absent.
  • Recognize native Placeholder values, validate trailing placeholders before flattening, and reuse shared constructor argument binding with lazy instance-dictionary allocation.
  • Validate restored state before tuple-subclass callbacks or state changes, preserve supplied instance dictionary identity, and copy keyword subclasses without rehashing stored keys.
  • Preserve absent versus allocated-empty dictionaries in reduction.

Invalid state is rejected before mutation. Successful field replacement remains sequential, matching CPython rather than claiming transactional reentrant updates.

Reference: CPython 3.15.0 partial construction and state restoration.

Validation

  • Eight bounded CPython 3.15 reference groups passed, including fresh-dictionary, flattening, callback, identity, and invalid-state cases.
  • Independent source review caught and resolved an eager-dictionary allocation issue; final formatting and whitespace checks passed.
  • Final focused VM, host-env and stdlib check and strict Clippy with rustpython-stdlib/threading passed. Normal repository commit hooks passed.
  • RustPython runtime, full workspace/C-API suites, and cross-platform execution were not run. No test, Lib, workflow, or marker edits.

AI assistance: OpenAI Codex performed source comparison, implementation, reference probes, and independent source review; model version was not exposed.

Preserve nested keyword ownership and lazy instance dictionaries, use
native Placeholder identity, and share constructor argument binding.
Validate restored state before callback conversion, retain instance dict
identity, and copy stored keyword entries without rehashing keys.

Assisted-by: OpenAI Codex:model version not exposed
PosArgs exposes its borrowed slice through AsRef rather than as_slice.

Assisted-by: OpenAI Codex:model version not exposed
Avoid a redundant strong reference when constructing a nonnested partial.

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

coderabbitai Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • 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

@codspeed

codspeed Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 62 untouched benchmarks
⏩ 4 skipped benchmarks1


Comparing youknowdot:partial-state-controls-group-20261103 (d41e7e0) with main (0b081b0)

Open in CodSpeed

Footnotes

  1. 4 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant