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

Function set_from_windows_err

crates/stdlib/src/overlapped.rs:280–293  ·  view source on GitHub ↗
(err: u32, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

278 }
279
280 fn set_from_windows_err(err: u32, vm: &VirtualMachine) -> PyBaseExceptionRef {
281 let err = if err == 0 {
282 unsafe { GetLastError() }
283 } else {
284 err
285 };
286 let errno = crate::vm::common::os::winerror_to_errno(err as i32);
287 let message = std::io::Error::from_raw_os_error(err as i32).to_string();
288 let exc = vm.new_errno_error(errno, message);
289 let _ = exc
290 .as_object()
291 .set_attr("winerror", err.to_pyobject(vm), vm);
292 exc.upcast()
293 }
294
295 fn HasOverlappedIoCompleted(overlapped: &OVERLAPPED) -> bool {
296 overlapped.Internal != (Foundation::STATUS_PENDING as usize)

Callers 15

parse_addressFunction · 0.85
cancelMethod · 0.85
getresultMethod · 0.85
ReadFileMethod · 0.85
ReadFileIntoMethod · 0.85
WSARecvMethod · 0.85
WSARecvIntoMethod · 0.85
WriteFileMethod · 0.85
WSASendMethod · 0.85
AcceptExMethod · 0.85
ConnectExMethod · 0.85

Calls 8

winerror_to_errnoFunction · 0.85
to_stringMethod · 0.80
new_errno_errorMethod · 0.80
upcastMethod · 0.80
GetLastErrorFunction · 0.50
set_attrMethod · 0.45
as_objectMethod · 0.45
to_pyobjectMethod · 0.45

Tested by

no test coverage detected