◐ Shell
clean mode source ↗

winapi functions by youknowone · Pull Request #7516 · RustPython/RustPython

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

Run ID: a776badd-ed7f-4e4f-b714-b63a43a4efff

📥 Commits

Reviewing files that changed from the base of the PR and between 4107217 and 53bfedd.

📒 Files selected for processing (2)
  • crates/vm/Cargo.toml
  • crates/vm/src/stdlib/_winapi.rs

📝 Walkthrough

Walkthrough

This PR extends RustPython's Windows API bindings by adding the Win32_System_JobObjects feature to the Cargo dependency manifest and implementing four Python-exposed wrapper functions for Windows Job Object operations: job creation, process assignment, termination, and kill-on-close configuration.

Changes

Cohort / File(s) Summary
Cargo Dependency Configuration
crates/vm/Cargo.toml
Added Win32_System_JobObjects feature to the Windows-only dependency list.
Windows API Bindings
crates/vm/src/stdlib/_winapi.rs
Implemented four Job Object wrapper functions: CreateJobObject (with optional name parameter and UTF-16 conversion), AssignProcessToJobObject, TerminateJobObject, and SetJobObjectKillOnClose. Each function wraps the corresponding Windows System API and returns errors via vm.new_last_os_error().

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~15 minutes

Possibly related PRs

  • RustPython/RustPython#7185: Adds additional Win32 API bindings to the same _winapi module alongside Job Object functions.
  • RustPython/RustPython#6356: Establishes Windows API surface patterns in crates/vm using windows-sys features and WinHandle conventions that this PR builds upon.

Poem

🐰✨ A rabbit hops with glee so bright,
Job Objects now in Python's sight!
Windows tasks we tame and bind,
Process control, perfectly designed!
Four new functions, clean and tight—
RustPython shines more every night! 🌙

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'winapi functions' is vague and generic, failing to convey what specific functionality was added or modified to the Windows API bindings. Use a more specific title such as 'Add Windows Job Object API bindings' or 'Expose Job Object management functions via _winapi module'.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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 and usage tips.