lock = threading.Lock()
self.assertRaises(RuntimeError, lock.release)
- @unittest.skipUnless(sys.platform == 'darwin' and test.support.python_is_optimized(),
- 'test macosx problem')
def test_recursion_limit(self):
# Issue 9670
# test that excessive recursion within a non-main thread causes
--- /dev/null
+Increase the default stack size of threads from 5MB to 16MB on macOS, to
+match the stack size of the main thread. This avoids crashes on deep recursion
+in threads.
*/
#if defined(__APPLE__) && defined(THREAD_STACK_SIZE) && THREAD_STACK_SIZE == 0
#undef THREAD_STACK_SIZE
-#define THREAD_STACK_SIZE 0x500000
+/* Note: This matches the value of -Wl,-stack_size in configure.ac */
+#define THREAD_STACK_SIZE 0x1000000
#endif
#if defined(__FreeBSD__) && defined(THREAD_STACK_SIZE) && THREAD_STACK_SIZE == 0
#undef THREAD_STACK_SIZE
# Issue #18075: the default maximum stack size (8MBytes) is too
# small for the default recursion limit. Increase the stack size
# to ensure that tests don't crash
+ # Note: This matches the value of THREAD_STACK_SIZE in
+ # thread_pthread.h
LINKFORSHARED="-Wl,-stack_size,1000000 $LINKFORSHARED"
if test "$enable_framework"
# Issue #18075: the default maximum stack size (8MBytes) is too
# small for the default recursion limit. Increase the stack size
# to ensure that tests don't crash
+ # Note: This matches the value of THREAD_STACK_SIZE in
+ # thread_pthread.h
LINKFORSHARED="-Wl,-stack_size,1000000 $LINKFORSHARED"
if test "$enable_framework"