Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 985eebf

Browse filesBrowse files
authored
Merge pull request #5589 from youknowone/pyattr-const
Replace pyattr(once) to constant
2 parents bf28152 + 87fae15 commit 985eebf
Copy full SHA for 985eebf

File tree

1 file changed

+6
-5
lines changed
Filter options

1 file changed

+6
-5
lines changed

‎stdlib/src/overlapped.rs

Copy file name to clipboardExpand all lines: stdlib/src/overlapped.rs
+6-5Lines 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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.