bpo-18049: Sync thread stack size to main thread size on macOS (GH-14… · python/cpython@1a057ba (original) (raw)
5 files changed
lines changed
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1057,8 +1057,6 @@ def test_releasing_unacquired_lock(self): | ||
1057 | 1057 | lock = threading.Lock() |
1058 | 1058 | self.assertRaises(RuntimeError, lock.release) |
1059 | 1059 | |
1060 | -@unittest.skipUnless(sys.platform == 'darwin' and test.support.python_is_optimized(), | |
1061 | - 'test macosx problem') | |
1062 | 1060 | def test_recursion_limit(self): |
1063 | 1061 | # Issue 9670 |
1064 | 1062 | # test that excessive recursion within a non-main thread causes |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
1 | +Increase the default stack size of threads from 5MB to 16MB on macOS, to | |
2 | +match the stack size of the main thread. This avoids crashes on deep recursion | |
3 | +in threads. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -40,7 +40,8 @@ | ||
40 | 40 | */ |
41 | 41 | #if defined(__APPLE__) && defined(THREAD_STACK_SIZE) && THREAD_STACK_SIZE == 0 |
42 | 42 | #undef THREAD_STACK_SIZE |
43 | -#define THREAD_STACK_SIZE 0x500000 | |
43 | +/* Note: This matches the value of -Wl,-stack_size in configure.ac */ | |
44 | +#define THREAD_STACK_SIZE 0x1000000 | |
44 | 45 | #endif |
45 | 46 | #if defined(__FreeBSD__) && defined(THREAD_STACK_SIZE) && THREAD_STACK_SIZE == 0 |
46 | 47 | #undef THREAD_STACK_SIZE |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -9542,6 +9542,8 @@ then | ||
9542 | 9542 | # Issue #18075: the default maximum stack size (8MBytes) is too |
9543 | 9543 | # small for the default recursion limit. Increase the stack size |
9544 | 9544 | # to ensure that tests don't crash |
9545 | +# Note: This matches the value of THREAD_STACK_SIZE in | |
9546 | +# thread_pthread.h | |
9545 | 9547 | LINKFORSHARED="-Wl,-stack_size,1000000 $LINKFORSHARED" |
9546 | 9548 | |
9547 | 9549 | if test "$enable_framework" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -2694,6 +2694,8 @@ then | ||
2694 | 2694 | # Issue #18075: the default maximum stack size (8MBytes) is too |
2695 | 2695 | # small for the default recursion limit. Increase the stack size |
2696 | 2696 | # to ensure that tests don't crash |
2697 | +# Note: This matches the value of THREAD_STACK_SIZE in | |
2698 | +# thread_pthread.h | |
2697 | 2699 | LINKFORSHARED="-Wl,-stack_size,1000000 $LINKFORSHARED" |
2698 | 2700 | |
2699 | 2701 | if test "$enable_framework" |