aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Oudkerk <shibturn@gmail.com>2013-01-01 17:36:53 +0000
committerRichard Oudkerk <shibturn@gmail.com>2013-01-01 17:36:53 +0000
commit9b4599322d66a177ca3a2c318b674aaac88d3c90 (patch)
tree7da3adebe64f74b9b1c1983d7bd43386e7b9e7bb
parentMake indentation consistent (diff)
parentIssue #9586: Redefine SEM_FAILED on MacOSX to keep compiler happy. (diff)
downloadcpython-9b4599322d66a177ca3a2c318b674aaac88d3c90.tar.gz
cpython-9b4599322d66a177ca3a2c318b674aaac88d3c90.tar.bz2
cpython-9b4599322d66a177ca3a2c318b674aaac88d3c90.zip
Issue #9586: Merge
-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 c2c1c336e75..efd4343af6b 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -124,6 +124,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 #16688: Fix backreferences did make case-insensitive regex fail on
diff --git a/Modules/_multiprocessing/semaphore.c b/Modules/_multiprocessing/semaphore.c
index 8ea92f2b588..2c2b020e3bd 100644
--- a/Modules/_multiprocessing/semaphore.c
+++ b/Modules/_multiprocessing/semaphore.c
@@ -186,6 +186,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