gh-110014: Fix inconsistent struct definition in pycore_semaphore.h · python/cpython@6e0228b (original) (raw)

Skip to content

Provide feedback

Saved searches

Use saved searches to filter your results more quickly

Sign up

Appearance settings

Commit 6e0228b

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.

File tree

1 file changed

lines changed

1 file changed

lines changed

Lines changed: 4 additions & 0 deletions

Original file line number Diff line number Diff line change
@@ -20,6 +20,10 @@
20 20 # error "Require native threads. See https://bugs.python.org/issue31370"
21 21 #endif
22 22
23 +#ifndef MS_WINDOWS
24 +# include <unistd.h> // _POSIX_SEMAPHORES
25 +#endif
26 +
23 27 #if (defined(_POSIX_SEMAPHORES) && (_POSIX_SEMAPHORES+0) != -1 && \
24 28 defined(HAVE_SEM_TIMEDWAIT))
25 29 # define _Py_USE_SEMAPHORES