From 6e0228b7438d258e90e20ab7ee1bd045e489411a Mon Sep 17 00:00:00 2001 From: Sam Gross Date: Thu, 28 Sep 2023 10:50:28 -0400 Subject: [PATCH] gh-110014: Fix inconsistent struct definition in pycore_semaphore.h The pycore_semaphore.h header is included by Python/lock.c and Python/parking_lot.c. The macro `_POSIX_SEMAPHORES` was not consistently defined across the two files (due to a missing include of ``) leading to different struct definitions. The RHEL8 ppc64le LTO buildbot correctly warned due to this issue. --- Include/internal/pycore_semaphore.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Include/internal/pycore_semaphore.h b/Include/internal/pycore_semaphore.h index 2a4ecb7147acee..2aeaa72eaae3ac 100644 --- a/Include/internal/pycore_semaphore.h +++ b/Include/internal/pycore_semaphore.h @@ -20,6 +20,10 @@ # error "Require native threads. See https://bugs.python.org/issue31370" #endif +#ifndef MS_WINDOWS +# include // _POSIX_SEMAPHORES +#endif + #if (defined(_POSIX_SEMAPHORES) && (_POSIX_SEMAPHORES+0) != -1 && \ defined(HAVE_SEM_TIMEDWAIT)) # define _Py_USE_SEMAPHORES