Skip to content

Commit 6de45e1

Browse files
authored
Align positional OS and import signatures (#9568)
Use the CPython parameter names for nt.kill, nt.waitpid, and _imp.exec_dynamic, and reject keyword arguments for nt._path_isdir. Assisted-by: dot:frontier-intelligence
1 parent e7b4fea commit 6de45e1

2 files changed

Lines changed: 8 additions & 7 deletions

File tree

‎crates/vm/src/stdlib/_imp.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ mod _imp {
403403
}
404404

405405
#[pyfunction]
406-
fn exec_dynamic(_module: PyRef<PyModule>) -> i32 {
406+
fn exec_dynamic(_mod: PyRef<PyModule>) -> i32 {
407407
0
408408
}
409409

‎crates/vm/src/stdlib/nt.rs‎

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -330,8 +330,9 @@ pub(crate) mod module {
330330

331331
// return _testFileType(path, PY_IFDIR)
332332
#[pyfunction]
333-
fn _path_isdir(args: PathArg, vm: &VirtualMachine) -> bool {
334-
args.to_path_or_fd(vm)
333+
fn _path_isdir(path: PyObjectRef, vm: &VirtualMachine) -> bool {
334+
PathArg { path }
335+
.to_path_or_fd(vm)
335336
.is_some_and(|p| _test_file_type(&p, PY_IFDIR))
336337
}
337338

@@ -378,8 +379,8 @@ pub(crate) mod module {
378379

379380
#[cfg(target_env = "msvc")]
380381
#[pyfunction]
381-
fn waitpid(pid: intptr_t, opt: i32, vm: &VirtualMachine) -> PyResult<(intptr_t, u64)> {
382-
let (pid, status) = host_nt::cwait(pid, opt).map_err(|_| vm.new_last_errno_error())?;
382+
fn waitpid(pid: intptr_t, options: i32, vm: &VirtualMachine) -> PyResult<(intptr_t, u64)> {
383+
let (pid, status) = host_nt::cwait(pid, options).map_err(|_| vm.new_last_errno_error())?;
383384
// Cast to unsigned to handle large exit codes (like 0xC000013A)
384385
// then shift left by 8 to match POSIX waitpid format
385386
let ustatus = (status as u32) as u64;
@@ -393,8 +394,8 @@ pub(crate) mod module {
393394
}
394395

395396
#[pyfunction]
396-
fn kill(pid: i32, sig: isize, vm: &VirtualMachine) -> PyResult<()> {
397-
host_nt::kill(pid as u32, sig as u32).map_err(|err| err.to_pyexception(vm))
397+
fn kill(pid: i32, signal: isize, vm: &VirtualMachine) -> PyResult<()> {
398+
host_nt::kill(pid as u32, signal as u32).map_err(|err| err.to_pyexception(vm))
398399
}
399400

400401
#[pyfunction]

0 commit comments

Comments
 (0)