summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Oudkerk <shibturn@gmail.com>2013-01-01 17:29:44 (GMT)
committerRichard Oudkerk <shibturn@gmail.com>2013-01-01 17:29:44 (GMT)
commit9866231eab8884022f41ee7bb96d3539ba8d53ea (patch)
tree108aff705c66d0adf89fd9958ad258de2b2cf588
parent5e844c8052d13202261c2eb95f07802615c66921 (diff)
downloadcpython-9866231eab8884022f41ee7bb96d3539ba8d53ea.zip
cpython-9866231eab8884022f41ee7bb96d3539ba8d53ea.tar.gz
cpython-9866231eab8884022f41ee7bb96d3539ba8d53ea.tar.bz2
Issue #9586: Redefine SEM_FAILED on MacOSX to keep compiler happy.
-rw-r--r--Misc/NEWS2
-rw-r--r--Modules/_multiprocessing/semaphore.c7
2 files changed, 9 insertions, 0 deletions
diff --git a/Misc/NEWS b/Misc/NEWS
index 9e04951..a7e2534 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -189,6 +189,8 @@ Core and Builtins
Library
-------
+- Issue #9586: Redefine SEM_FAILED on MacOSX to keep compiler happy.
+
- Issue 10527: make multiprocessing use poll() instead of select() if available.
- Issue #16485: Fix file descriptor not being closed if file header patching
diff --git a/Modules/_multiprocessing/semaphore.c b/Modules/_multiprocessing/semaphore.c
index 1f37d6a..1ee224d 100644
--- a/Modules/_multiprocessing/semaphore.c
+++ b/Modules/_multiprocessing/semaphore.c
@@ -197,6 +197,13 @@ semlock_release(SemLockObject *self, PyObject *args)
#define SEM_GETVALUE(sem, pval) sem_getvalue(sem, pval)
#define SEM_UNLINK(name) sem_unlink(name)
+/* OS X 10.4 defines SEM_FAILED as -1 instead of (sem_t *)-1; this gives
+ compiler warnings, and (potentially) undefined behaviour. */
+#ifdef __APPLE__
+# undef SEM_FAILED
+# define SEM_FAILED ((sem_t *)-1)
+#endif
+
#ifndef HAVE_SEM_UNLINK
# define sem_unlink(name) 0
#endif