Skip to content

Accept buffer exporters for binary registry values - #9607

Merged
youknowone merged 2 commits into
RustPython:mainfrom
youknowdot:fix/winreg-binary-buffer-20261103
Nov 4, 2026
Merged

youknowone merged 2 commits into
RustPython:mainfrom
youknowdot:fix/winreg-binary-buffer-20261103

Conversation

@youknowdot

Copy link
Copy Markdown
Contributor

Summary

Allow buffer exporters, such as bytearray and memoryview, for REG_BINARY and unknown registry value types as CPython does. Exact bytes keep the existing direct single-copy path; other objects are checked for the buffer protocol, acquired with SIMPLE flags, copied, and released before the registry call. Exporter errors are propagated instead of being mistaken for lack of buffer support.

The key handle is snapshotted before newly supported buffer acquisition/release callbacks can run, so those callbacks cannot change the handle subsequently passed to Windows.

This does not claim complete SetValueEx parity: earlier type-argument conversion ordering, integer-key support, the absent winreg.SetValue audit event, and allocation-failure behavior remain separate issues. #9604 edits the preceding REG_MULTI_SZ branch and #9573 changes nearby SetValueEx parameter names; these should be checked together.

Validation

  • Independently source-reviewed against CPython v3.15.0 PC/winreg.c and RustPython's SIMPLE buffer acquisition/release path.
  • prek hooks and git diff --check passed.
  • No RustPython compilation or Windows execution was run locally; CI is needed.

Keep exact bytes on the direct path, acquire a simple buffer for other exporters, and snapshot the key before buffer callbacks run.

Assisted-by: dot:frontier-intelligence
@coderabbitai

coderabbitai Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 46 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 10 included reviews currently available.

Learn how review limits work.

Review configuration:

Run configuration
Commits

Reviewing files that changed from the base of the PR and between b51d849 and f264d42.

Files selected for processing: 1
  • crates/vm/src/stdlib/winreg.rs
  • 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

CodeRabbit Verify

  • Run CodeRabbit Verify to test the changes in this pull request.

Keep the early HKEY snapshot and binary buffer conversion while adopting the upstream SetValueEx type parameter name.

Assisted-by: dot:frontier-intelligence
@youknowone
youknowone marked this pull request as ready for review November 3, 2026 19:05
@youknowone
youknowone enabled auto-merge (squash) November 3, 2026 19:05
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-03T19:08:56.757088Z f264d42 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.

@youknowone
youknowone merged commit 0f95041 into RustPython:main Nov 4, 2026
28 checks passed
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.

2 participants