[Python-checkins] cpython (merge 3.2 -> default): Issue #14184: merge

ned.deily python-checkins at python.org
Tue Mar 13 19:33:11 CET 2012


http://hg.python.org/cpython/rev/c00ac2b25048
changeset:   75597:c00ac2b25048
parent:      75595:9d69a2418d80
parent:      75596:246e681a4272
user:        Ned Deily <nad at acm.org>
date:        Tue Mar 13 11:31:36 2012 -0700
summary:
  Issue #14184: merge

files:
  Misc/NEWS               |   3 +++
  Python/thread_pthread.h |  20 ++++++++++++--------
  2 files changed, 15 insertions(+), 8 deletions(-)


diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -24,6 +24,9 @@
 Library
 -------
 
+- Issue #14184: Increase the default stack size for secondary threads on
+  Mac OS X to avoid interpreter crashes when using threads on 10.7.
+
 - Issue #14180: time.ctime(), gmtime(), time.localtime(),
   datetime.date.fromtimestamp(), datetime.datetime.fromtimestamp() and
   datetime.datetime.utcfromtimestamp() now raises an OverflowError, instead of
diff --git a/Python/thread_pthread.h b/Python/thread_pthread.h
--- a/Python/thread_pthread.h
+++ b/Python/thread_pthread.h
@@ -19,14 +19,18 @@
 #define THREAD_STACK_SIZE       0       /* use default stack size */
 #endif
 
-#if (defined(__APPLE__) || defined(__FreeBSD__)) && defined(THREAD_STACK_SIZE) && THREAD_STACK_SIZE == 0
-   /* The default stack size for new threads on OSX is small enough that
-    * we'll get hard crashes instead of 'maximum recursion depth exceeded'
-    * exceptions.
-    *
-    * The default stack size below is the minimal stack size where a
-    * simple recursive function doesn't cause a hard crash.
-    */
+/* The default stack size for new threads on OSX and BSD is small enough that
+ * we'll get hard crashes instead of 'maximum recursion depth exceeded'
+ * exceptions.
+ *
+ * The default stack sizes below are the empirically determined minimal stack
+ * sizes where a simple recursive function doesn't cause a hard crash.
+ */
+#if defined(__APPLE__) && defined(THREAD_STACK_SIZE) && THREAD_STACK_SIZE == 0
+#undef  THREAD_STACK_SIZE
+#define THREAD_STACK_SIZE       0x500000
+#endif
+#if defined(__FreeBSD__) && defined(THREAD_STACK_SIZE) && THREAD_STACK_SIZE == 0
 #undef  THREAD_STACK_SIZE
 #define THREAD_STACK_SIZE       0x400000
 #endif

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


More information about the Python-checkins mailing list