Skip to content

Commit 577c830

Browse files
committed
Issue #14184: merge
2 parents bd273c1 + 7ca97d5 commit 577c830

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed

Misc/NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ Core and Builtins
2424
Library
2525
-------
2626

27+
- Issue #14184: Increase the default stack size for secondary threads on
28+
Mac OS X to avoid interpreter crashes when using threads on 10.7.
29+
2730
- Issue #14180: time.ctime(), gmtime(), time.localtime(),
2831
datetime.date.fromtimestamp(), datetime.datetime.fromtimestamp() and
2932
datetime.datetime.utcfromtimestamp() now raises an OverflowError, instead of

Python/thread_pthread.h

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,18 @@
1919
#define THREAD_STACK_SIZE 0 /* use default stack size */
2020
#endif
2121

22-
#if (defined(__APPLE__) || defined(__FreeBSD__)) && defined(THREAD_STACK_SIZE) && THREAD_STACK_SIZE == 0
23-
/* The default stack size for new threads on OSX is small enough that
24-
* we'll get hard crashes instead of 'maximum recursion depth exceeded'
25-
* exceptions.
26-
*
27-
* The default stack size below is the minimal stack size where a
28-
* simple recursive function doesn't cause a hard crash.
29-
*/
22+
/* The default stack size for new threads on OSX and BSD is small enough that
23+
* we'll get hard crashes instead of 'maximum recursion depth exceeded'
24+
* exceptions.
25+
*
26+
* The default stack sizes below are the empirically determined minimal stack
27+
* sizes where a simple recursive function doesn't cause a hard crash.
28+
*/
29+
#if defined(__APPLE__) && defined(THREAD_STACK_SIZE) && THREAD_STACK_SIZE == 0
30+
#undef THREAD_STACK_SIZE
31+
#define THREAD_STACK_SIZE 0x500000
32+
#endif
33+
#if defined(__FreeBSD__) && defined(THREAD_STACK_SIZE) && THREAD_STACK_SIZE == 0
3034
#undef THREAD_STACK_SIZE
3135
#define THREAD_STACK_SIZE 0x400000
3236
#endif

0 commit comments

Comments
 (0)