◐ Shell
clean mode source ↗

winapi suppliment by youknowone · Pull Request #6338 · RustPython/RustPython

Caution

Review failed

The pull request is closed.

Walkthrough

Three Windows stdlib modules are enhanced with new API bindings: GetErrorMode() function added to msvcrt, three IO_REPARSE_TAG_* constants added to stat under Windows cfg, and winapi.rs receives updated GetStdHandle/DuplicateHandle signatures plus new ExitProcess function.

Changes

Cohort / File(s) Summary
msvcrt module
crates/vm/src/stdlib/msvcrt.rs
Adds public Python-exposed GetErrorMode() function that wraps Windows Debug::GetErrorMode() API, returning u32 result.
stat module (Windows constants)
crates/vm/src/stdlib/stat.rs
Adds three Windows-specific reparse point tag constants under #[cfg(windows)]: IO_REPARSE_TAG_SYMLINK, IO_REPARSE_TAG_MOUNT_POINT, IO_REPARSE_TAG_APPEXECLINK as public #[pyattr] items.
winapi module
crates/vm/src/stdlib/winapi.rs
Updates GetStdHandle() signature to accept vm: &VirtualMachine parameter and return PyResult<Option<HANDLE>>; refactors DuplicateHandle() parameters from tuple (src_process, src) to separate src_process: HANDLE, src: HANDLE parameters; adds new ExitProcess(exit_code: u32) public function.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~15 minutes

  • Signature changes to GetStdHandle and DuplicateHandle should be checked for call-site compatibility
  • Verify return type changes in GetStdHandle are correctly handled in existing code paths
  • Confirm new constants align with official Windows API definitions

Possibly related PRs

Poem

🐰 Hops through the Windows API ways,
GetErrorMode guides through error maze,
Reparse tags planted in stat's soil,
Exit swift with ExitProcess toil,
Handles duplicated, futures bright! 🪟✨

Pre-merge checks and finishing touches

❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'winapi suppliment' is vague and does not clearly convey the scope of changes, which include additions to msvcrt, stat, winapi, codecs, and windows modules. Consider a more descriptive title that reflects the main changes, such as 'Add Windows API functions and codec support' or 'Extend Windows stdlib modules with new functions and constants'.
✅ 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%.

📜 Recent review details

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0e0bd1e and a97c075.

⛔ Files ignored due to path filters (3)
  • Lib/test/test_faulthandler.py is excluded by !Lib/**
  • Lib/test/test_shutil.py is excluded by !Lib/**
  • Lib/test/test_subprocess.py is excluded by !Lib/**
📒 Files selected for processing (3)
  • crates/vm/src/stdlib/msvcrt.rs (1 hunks)
  • crates/vm/src/stdlib/stat.rs (1 hunks)
  • crates/vm/src/stdlib/winapi.rs (4 hunks)

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.