Skip to content

Implement Python 3.15 Windows event-log APIs - #9086

Merged
youknowone merged 3 commits into
RustPython:mainfrom
youknowdot:winapi-eventlog-315
Oct 12, 2026
Merged

youknowone merged 3 commits into
RustPython:mainfrom
youknowdot:winapi-eventlog-315

Conversation

@youknowdot

Copy link
Copy Markdown
Contributor

Summary

Extract the Python 3.15 Windows event-log API support from #8954 as one cohesive Rust-only prerequisite for #9079's final-source standard-library synchronization.

  • Expose _winapi.RegisterEventSource, DeregisterEventSource and ReportEvent.
  • Add checked host-environment wrappers and six EVENTLOG_* constants.
  • Enable windows-sys's Win32_System_EventLog feature.
  • Add a Windows-only snippet checking six constants and twenty pre-host conversion failures.

The implementation follows CPython's final 3.15 source at d220409a13b77de7a6c30abe16ea90db01528edc. The Rust/Cargo implementation is the exact three-file extraction from 43065e7, rebased on main a107443. No Lib files or test expectations change.

Validation

  • Applicable pre-commit hooks and git diff --check: passed.
  • cargo check --locked -p rustpython-host_env --target x86_64-pc-windows-gnu -j1: passed.
  • cargo clippy --locked -p rustpython-host_env --target x86_64-pc-windows-gnu -j1 -- -D warnings: passed.
  • cargo check --locked -p rustpython-vm --no-default-features --features host_env --target x86_64-pc-windows-gnu -j1: blocked in dependency psm by missing x86_64-w64-mingw32-gcc; the changed VM source was not reached. The Windows target cfg and host_env feature are enabled.
  • New extra_tests/snippets/stdlib_winapi_eventlog.py is discovered by the existing Windows snippets job. All calls reject before host operations; overflow cases retain an independent NUL guard. Actual Windows assertions await hosted CI.
  • Targeted Linux pytest: 2 passed (CPython and RustPython), validating collection and the non-Windows gate only.
  • No event-log writes, registry edits or Windows runtime tests performed locally. Full workspace/C-API/runtime tests remain unrun; hosted Windows compile and conversion checks remain outstanding.

AI assistance

Codex assisted extraction from the existing mega PR, comparison with final CPython source, source review, compile-check preparation and this description. The maintainer directed this extraction. Windows runtime validation is not claimed.

Extract RegisterEventSource, DeregisterEventSource, ReportEvent and six constants from the existing Python 3.15 work. Match final CPython conversion and Win32 call contracts, with Windows-only argument rejection coverage that cannot perform host operations.

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

coderabbitai Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration
  • Configuration used: Repository: RustPython/RustPython/.coderabbit.yml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 29e63c4d-6a4f-43fa-9afc-597321105208

📥 Commits

Reviewing files that changed from the base of the PR and between f39da82 and 6826d1a.


📒 Files selected for processing (4)
  • crates/host_env/Cargo.toml
  • crates/host_env/src/winapi.rs
  • crates/vm/src/stdlib/_winapi.rs
  • extra_tests/snippets/stdlib_winapi.py

 _________________________________________________
< Undefined behavior is my favorite horror genre. >
 -------------------------------------------------
  \
   \   (\__/)
       (•ㅅ•)
       /   づ
✨ 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.

Keep every pre-host rejection case and distinguish negative ValueError from positive OverflowError, as the final Python 3.15 Clinic converters do.

Assisted-by: OpenAI Codex:model identifier unavailable

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

stdlib_winapi.py

Preserve all existing regression bodies and coverage while following the requested snippet organization.

Assisted-by: OpenAI Codex:model identifier unavailable
@codspeed

codspeed Bot commented Oct 12, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 62 untouched benchmarks
⏩ 4 skipped benchmarks1


Comparing youknowdot:winapi-eventlog-315 (6826d1a) with main (9ea138c)

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. ↩

@youknowone
youknowone marked this pull request as ready for review October 12, 2026 07:12
@youknowone
youknowone merged commit e8cb0c7 into RustPython:main Oct 12, 2026
30 checks passed
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 12, 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-10-12T07:24:50.130099Z 6826d1a 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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6826d1aa2d

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".


# Every call fails before a host operation. ReportEvent overflow cases
# also retain an embedded NUL as an independent safety barrier.
assert _winapi.EVENTLOG_SUCCESS == 0

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Remove the prohibited test assertions

This newly created snippet adds assertion logic, which is outside the only two test-file changes permitted by the root AGENTS.md (adding or removing expected-failure decorators). Remove this test addition or secure a policy exception before landing it; as written, the change violates the repository's mandatory test-code modification rules.

AGENTS.md reference: AGENTS.md:L273-L280

Useful? React with 👍 / 👎.

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