Skip to content

Commit 1882e0a

Browse files
committed
Safe casts on Windows
1 parent 704645f commit 1882e0a

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Python/thread_nt.h

+3-1
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@ PyThread_start_joinable_thread(void (*func)(void *), void *arg,
211211
return -1;
212212
}
213213
*ident = threadID;
214+
// The cast is safe since HANDLE is pointer-sized
214215
*handle = (Py_uintptr_t) hThread;
215216
return 0;
216217
}
@@ -223,7 +224,8 @@ PyThread_start_new_thread(void (*func)(void *), void *arg) {
223224
return PYTHREAD_INVALID_THREAD_ID;
224225
}
225226
CloseHandle((HANDLE) handle);
226-
return ident;
227+
// The cast is safe since the ident is really an unsigned int
228+
return (unsigned long) ident;
227229
}
228230

229231
int

0 commit comments

Comments
 (0)