MCPcopy Index your code
hub / github.com/RustPython/RustPython / CreateJobObject

Function CreateJobObject

crates/vm/src/stdlib/_winapi.rs:619–640  ·  view source on GitHub ↗
(
        _security_attributes: PyObjectRef,
        name: OptionalArg<Option<PyStrRef>>,
        vm: &VirtualMachine,
    )

Source from the content-addressed store, hash-verified

617
618 #[pyfunction]
619 fn CreateJobObject(
620 _security_attributes: PyObjectRef,
621 name: OptionalArg<Option<PyStrRef>>,
622 vm: &VirtualMachine,
623 ) -> PyResult<WinHandle> {
624 let handle = unsafe {
625 match name.flatten() {
626 Some(name) => {
627 let name_wide = name.as_wtf8().to_wide_with_nul();
628 windows_sys::Win32::System::JobObjects::CreateJobObjectW(
629 null(),
630 name_wide.as_ptr(),
631 )
632 }
633 None => windows_sys::Win32::System::JobObjects::CreateJobObjectW(null(), null()),
634 }
635 };
636 if handle.is_null() {
637 return Err(vm.new_last_os_error());
638 }
639 Ok(WinHandle(handle))
640 }
641
642 #[pyfunction]
643 fn AssignProcessToJobObject(

Callers

nothing calls this directly

Calls 7

WinHandleClass · 0.85
to_wide_with_nulMethod · 0.80
new_last_os_errorMethod · 0.80
ErrClass · 0.50
flattenMethod · 0.45
as_wtf8Method · 0.45
as_ptrMethod · 0.45

Tested by

no test coverage detected