Skip to content

Preserve surrogates in winreg QueryValue results - #9602

Merged
youknowone merged 1 commit into
RustPython:mainfrom
youknowdot:fix/winreg-queryvalue-surrogates-20261103
Nov 4, 2026
Merged

youknowone merged 1 commit into
RustPython:mainfrom
youknowdot:fix/winreg-queryvalue-surrogates-20261103

Conversation

@youknowdot

Copy link
Copy Markdown
Contributor

Summary

Preserve unpaired UTF-16 surrogate code units in the string returned by winreg.QueryValue, matching CPython's PyUnicode_FromWideChar behavior. A new WTF-8 host path produces the Python string directly; the existing public Rust query_default_value signature and strict String-decoding behavior are retained through a shared monomorphized decoder.

The first-NUL rule, missing-value result, registry errors, and child-key close path remain as before. This patch does not change QueryValue argument parsing or claim complete registry parity.

This touches the same regions as #9593 and #9599. A local composition required conflict resolution to retain #9593's input conversion/audit and #9599's wide-unit alignment handling; that resolved source was independently reviewed, but has not been built or run.

Validation

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

Decode returned UTF-16 through WTF-8 for the Python API while retaining the existing public String host API.

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 48 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 18fc82b and 545a665.

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

@youknowone
youknowone marked this pull request as ready for review November 3, 2026 19:03
@youknowone
youknowone enabled auto-merge (squash) November 3, 2026 19:03
@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:06:22.122142Z 545a665 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 f942d52 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