Skip to content

Update Windows registry behavior and canonical 3.15 tests - #9420

Merged
youknowone merged 2 commits into
RustPython:mainfrom
youknowdot:youknowdot/windows-registry-tests-315-20261028
Oct 28, 2026
Merged

youknowone merged 2 commits into
RustPython:mainfrom
youknowdot:youknowdot/windows-registry-tests-315-20261028

Conversation

@youknowdot

@youknowdot youknowdot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Implement winreg.DeleteTree(key, sub_key=None, /) through the existing Windows registry bindings, with nullable wide-string conversion, audit emission, native error mapping, and thread release during the blocking call.
  • Accept the required-but-nullable sub_key in OpenKey/OpenKeyEx, forwarding None as a native NULL path. Preserve owned wide-string conversion, add the canonical audit events, and release threads during the native call.
  • Match CPython 3.15 HKEY equality/inequality by current handle value, including closed handles. Other types and ordering return NotImplemented. Preserve CPython's existing identity hash, which upstream itself retains despite the new value comparison.
  • Migrate the actual Lib/test/test_winreg.py and Lib/test/test_winapi.py via scripts/update_lib migrate from CPython d220409a13b77de7a6c30abe16ea90db01528edc. Both files are byte-identical to canonical upstream: no added skips, rewritten assertions, duplicate snippets, or backports. Existing event-log APIs already support the newly imported _winapi tests.

Validation

  • cargo fmt --check and git diff --check passed.
  • Applicable pre-commit hooks passed: merge-conflict check, rustfmt, cspell, ruff format/import checks, and redundant-test-patch validation.
  • cargo check --locked --offline -j1 --target x86_64-pc-windows-msvc -p rustpython-host_env --lib passed against the official Rust 1.99 Windows standard library.
  • Matching focused Windows host-env Clippy with -- -D warnings passed.
  • Default-feature Windows VM cross-check was attempted, but blocked in psm 0.1.32 native assembly before compiling VM Rust code: the available host cc rejects Windows PE directives (.def, .scl, .endef). No features were disabled and no SDK/compiler workaround was installed. The VM wrapper remains source-reviewed, not cross-compiled locally.

Limitations

  • This Linux environment cannot execute the Windows registry/event-log tests. No registry or event-log runtime operations were made on the host. Hosted Windows CI results are recorded below; maintainer review remains necessary, and Linux skips are not considered runtime validation.
  • Full workspace and C-API tests have not been run locally for this patch.
  • The new function reuses the existing HKEY argument converter and Windows error mapping. That converter's pre-existing negative-integer-handle difference from CPython is not expanded here; native error mapping does not add CPython's function-name suffix.

AI assistance

OpenAI Codex assisted with source comparison, implementation, canonical test migration, validation, and this description. Independent agent source review was performed; this is not a claim of human review or Windows runtime verification. Submitted as a draft for maintainer review.

Windows CI follow-up

The initial Windows run reached the canonical HKEY tests but failed at OpenKey(HKEY_CURRENT_USER, None) before testing comparison behavior. The existing OpenKey converter incorrectly required a string. The follow-up fixes this nullable-path prerequisite without making the argument optional or changing/skipping canonical tests. Windows CI has now validated the updated head successfully; local Windows runtime execution remains unavailable.

Hosted CI status

Verified on repaired head 70dce8cf067ddfa5e840818aa3e85855b06ec758: CI run 40633157939 completed successfully with all 24 jobs passing, and dependency check 40633154776 also succeeded. This includes the hosted Windows test job after the nullable-OpenKey fix; it does not change the local cross-compilation/runtime limitations or compatibility scope above. The PR remains a draft for maintainer review.

Add DeleteTree with nullable wide paths, audit emission, native errors, and thread release; compare HKEY handles as CPython does while retaining upstream identity hashing. Migrate canonical winreg and winapi tests from CPython d220409a13b77de7a6c30abe16ea90db01528edc.

Assisted-by: OpenAI Codex: model version unavailable
@coderabbitai

coderabbitai Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Caution

Review failed

The pull request is closed.

Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • 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

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown
Contributor

📦 Library Dependencies

The following Lib/ modules were modified. Here are their dependencies:

[x] test: cpython/Lib/test/test_winreg.py

dependencies:

dependent tests: (80 tests)

  • winreg: test_importlib test_launcher test_winreg
    • importlib._bootstrap_external: test_unittest
      • modulefinder: test_importlib test_modulefinder
      • py_compile: test_cmd_line_script test_compileall test_importlib test_multiprocessing_main_handling test_py_compile test_pydoc test_runpy
      • pydoc: test_enum
      • zipfile: test_pdb test_pkgutil test_shutil test_zipapp test_zipfile test_zipfile64 test_zipimport test_zipimport_support
    • logging.handlers: test_concurrent_futures test_logging
    • mimetypes: test_mimetypes
      • http.server: test_httpservers test_robotparser test_urllib2_localnet test_xmlrpc
      • urllib.request: test_http_cookiejar test_pathlib test_sax test_site test_ssl test_urllib test_urllib2 test_urllib2net test_urllibnet
    • platform: test__locale test__osx_support test_android test_asyncio test_baseexception test_builtin test_calendar test_cmath test_ctypes test_fcntl test_math test_os test_platform test_regrtest test_socket test_strptime test_sysconfig test_time test_tkinter test_wsgiref
      • profiling.sampling.gecko_collector: test_profiling
      • profiling.sampling.heatmap_collector: test_profiling
      • uuid: test_os
    • urllib.request:
      • pathlib: test_ast test_dbm_sqlite3 test_ensurepip test_importlib test_json test_netrc test_pathlib test_peg_generator test_pyrepl test_tarfile test_tempfile test_tomllib test_tools test_traceback test_unparse test_venv test_winapi test_zoneinfo test_zstd

[x] test: cpython/Lib/test/test_winapi.py

dependencies:

dependent tests: (no tests depend on winapi)

Legend:

  • [+] path exists in CPython
  • [x] up-to-date, [ ] outdated

Keep sub_key required while accepting None, matching CPython and the canonical HKEY comparison test prerequisite. Forward a null path to RegOpenKeyExW, retain owned wide strings across thread release, and emit the input and result audit events without leaking the returned handle on an audit error.

Assisted-by: OpenAI Codex: model version unavailable
@youknowone
youknowone marked this pull request as ready for review October 28, 2026 08:35
@youknowone
youknowone merged commit 07b1cdb into RustPython:main Oct 28, 2026
29 checks passed
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 28, 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 ⚠️ Failed 2026-10-28T08:37:16.460616Z
We couldn’t complete this review. Comment @codex review to try again.
70dce8c 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.

youknowdot pushed a commit to youknowdot/RustPython that referenced this pull request Oct 28, 2026
Integrate main 07b1cdb after the earlier unpublished main merge, carrying
landed RustPython#9415 through RustPython#9420. Preserve queue accounting, fcntl/ioctl buffers,
resource limits, complex memoryview and array formats, and Windows registry
compatibility with their canonical tests.

The automatic Cargo.lock merge adds the stdlib half dependency while
preserving the existing Ruff parser vendor override. Other incoming and
residual paths remain byte-for-byte with their respective parents.

The updater suite passed 226 tests; affected-file hooks passed. No fresh
local Rust build or interpreter runtime was run. Local cspell remains
deferred to exact-head CI under the user's instruction.

AI assistance covered source integration, review and validation.
Assisted-by: dot: model version not exposed
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.

3 participants