[Python-checkins] cpython (merge 3.2 -> 3.3): Issue #9586: Merge

richard.oudkerk python-checkins at python.org
Tue Jan 1 18:54:17 CET 2013


http://hg.python.org/cpython/rev/a70db584e897
changeset:   81192:a70db584e897
branch:      3.3
parent:      81189:3ff3f3ab5e5b
parent:      81191:a5b49db3383d
user:        Richard Oudkerk <shibturn at gmail.com>
date:        Tue Jan 01 17:36:53 2013 +0000
summary:
  Issue #9586: Merge

files:
  Misc/NEWS                            |  2 ++
  Modules/_multiprocessing/semaphore.c |  7 +++++++
  2 files changed, 9 insertions(+), 0 deletions(-)


diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -124,6 +124,8 @@
 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
--- a/Modules/_multiprocessing/semaphore.c
+++ b/Modules/_multiprocessing/semaphore.c
@@ -186,6 +186,13 @@
 #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

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list