Skip to content

Commit 87fae15

Browse files
committed
Replace pyattr(once) to constant
1 parent 97853bf commit 87fae15

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

stdlib/src/overlapped.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,11 @@ mod _overlapped {
3131
},
3232
System::Threading::INFINITE,
3333
};
34-
#[pyattr(once)]
35-
fn INVALID_HANDLE_VALUE(_vm: &VirtualMachine) -> isize {
36-
windows_sys::Win32::Foundation::INVALID_HANDLE_VALUE as isize
37-
}
34+
35+
#[pyattr]
36+
const INVALID_HANDLE_VALUE: isize =
37+
unsafe { std::mem::transmute(windows_sys::Win32::Foundation::INVALID_HANDLE_VALUE) };
38+
3839
#[pyattr]
3940
const NULL: isize = 0;
4041

@@ -263,7 +264,7 @@ mod _overlapped {
263264
type Args = (isize,);
264265

265266
fn py_new(cls: PyTypeRef, (mut event,): Self::Args, vm: &VirtualMachine) -> PyResult {
266-
if event == INVALID_HANDLE_VALUE(vm) {
267+
if event == INVALID_HANDLE_VALUE {
267268
event = unsafe {
268269
windows_sys::Win32::System::Threading::CreateEventA(
269270
std::ptr::null(),

0 commit comments

Comments
 (0)