Skip to content

Commit 6e0228b

Browse files
committed
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 `<unistd.h>`) leading to different struct definitions. The RHEL8 ppc64le LTO buildbot correctly warned due to this issue.
1 parent 9be283e commit 6e0228b

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Include/internal/pycore_semaphore.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@
2020
# error "Require native threads. See https://bugs.python.org/issue31370"
2121
#endif
2222

23+
#ifndef MS_WINDOWS
24+
# include <unistd.h> // _POSIX_SEMAPHORES
25+
#endif
26+
2327
#if (defined(_POSIX_SEMAPHORES) && (_POSIX_SEMAPHORES+0) != -1 && \
2428
defined(HAVE_SEM_TIMEDWAIT))
2529
# define _Py_USE_SEMAPHORES

0 commit comments

Comments
 (0)