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

Method py_new

crates/stdlib/src/overlapped.rs:1491–1521  ·  view source on GitHub ↗
(_cls: &Py<PyType>, (event,): Self::Args, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

1489 type Args = (OptionalArg<isize>,);
1490
1491 fn py_new(_cls: &Py<PyType>, (event,): Self::Args, vm: &VirtualMachine) -> PyResult<Self> {
1492 let mut event = event.unwrap_or(INVALID_HANDLE_VALUE);
1493
1494 if event == INVALID_HANDLE_VALUE {
1495 event = unsafe {
1496 windows_sys::Win32::System::Threading::CreateEventW(
1497 core::ptr::null(),
1498 Foundation::TRUE,
1499 Foundation::FALSE,
1500 core::ptr::null(),
1501 ) as isize
1502 };
1503 if event == NULL {
1504 return Err(set_from_windows_err(0, vm));
1505 }
1506 }
1507
1508 let mut overlapped: OVERLAPPED = unsafe { core::mem::zeroed() };
1509 if event != NULL {
1510 overlapped.hEvent = event as HANDLE;
1511 }
1512 let inner = OverlappedInner {
1513 overlapped,
1514 handle: NULL as HANDLE,
1515 error: 0,
1516 data: OverlappedData::None,
1517 };
1518 Ok(Overlapped {
1519 inner: PyMutex::new(inner),
1520 })
1521 }
1522 }
1523
1524 impl Destructor for Overlapped {

Callers

nothing calls this directly

Calls 4

CreateEventWFunction · 0.85
set_from_windows_errFunction · 0.85
newFunction · 0.85
ErrClass · 0.50

Tested by

no test coverage detected