[Python-checkins] bpo-38852: Set thread stack size to 8 Mb for debug builds on android platforms (GH-17337)
Victor Stinner
webhook-mailer at python.org
Sun Dec 8 02:40:19 EST 2019
https://github.com/python/cpython/commit/00ada2c1d57c5b8b468bad32ff24fa14113ae5c7
commit: 00ada2c1d57c5b8b468bad32ff24fa14113ae5c7
branch: master
author: xdegaye <xdegaye at gmail.com>
committer: Victor Stinner <vstinner at python.org>
date: 2019-12-08T08:40:14+01:00
summary:
bpo-38852: Set thread stack size to 8 Mb for debug builds on android platforms (GH-17337)
files:
A Misc/NEWS.d/next/Core and Builtins/2019-11-22-09-55-21.bpo-38852.y7oPEa.rst
M Python/thread_pthread.h
diff --git a/Misc/NEWS.d/next/Core and Builtins/2019-11-22-09-55-21.bpo-38852.y7oPEa.rst b/Misc/NEWS.d/next/Core and Builtins/2019-11-22-09-55-21.bpo-38852.y7oPEa.rst
new file mode 100644
index 0000000000000..915a936aae2d3
--- /dev/null
+++ b/Misc/NEWS.d/next/Core and Builtins/2019-11-22-09-55-21.bpo-38852.y7oPEa.rst
@@ -0,0 +1 @@
+Set the thread stack size to 8 Mb for debug builds on android platforms.
diff --git a/Python/thread_pthread.h b/Python/thread_pthread.h
index b9a340530cfe9..ff4266c72b4b3 100644
--- a/Python/thread_pthread.h
+++ b/Python/thread_pthread.h
@@ -51,6 +51,16 @@
#undef THREAD_STACK_SIZE
#define THREAD_STACK_SIZE 0x200000
#endif
+/* bpo-38852: test_threading.test_recursion_limit() checks that 1000 recursive
+ Python calls (default recursion limit) doesn't crash, but raise a regular
+ RecursionError exception. In debug mode, Python function calls allocates
+ more memory on the stack, so use a stack of 8 MiB. */
+#if defined(__ANDROID__) && defined(THREAD_STACK_SIZE) && THREAD_STACK_SIZE == 0
+# ifdef Py_DEBUG
+# undef THREAD_STACK_SIZE
+# define THREAD_STACK_SIZE 0x800000
+# endif
+#endif
/* for safety, ensure a viable minimum stacksize */
#define THREAD_STACK_MIN 0x8000 /* 32 KiB */
#else /* !_POSIX_THREAD_ATTR_STACKSIZE */
More information about the Python-checkins
mailing list