Skip to content

Commit 8c1a623

Browse files
committed
pythongh-151542: Use at least 2 MiB stack size, instead of 1 MiB
Python needs at least 2 MiB stack to run test_threading on Free Threading.
1 parent 0777a58 commit 8c1a623

3 files changed

Lines changed: 10 additions & 6 deletions

File tree

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Python now uses a stack size of at least 2 MiB, instead of 1 MiB. This is
2+
especially needed when Python is linked to musl (ex: Alpine Linux) which
3+
uses a default stack of 128 kiB. Patch by Victor Stinner.

‎configure‎

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎configure.ac‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2463,8 +2463,9 @@ AS_CASE([$ac_sys_system],
24632463
)
24642464

24652465
dnl On Linux, check the thread stack size. musl (ex: Alpine Linux) uses
2466-
dnl a default thread stack size of 128 kB, whereas the glibc uses 8 MiB.
2467-
dnl Python needs at least 1 MiB.
2466+
dnl a default thread stack size of 128 kiB, whereas the glibc uses 8 MiB.
2467+
dnl Python needs at least 2 MiB to run test_threading on Free Threading
2468+
dnl (gh-151542).
24682469
if test "$ac_sys_system" = "Linux" -a "$cross_compiling" = no; then
24692470
AC_CACHE_CHECK([for thread stack size], [ac_cv_thread_stack_size], [
24702471
cat > conftest.c <<EOF
@@ -2485,7 +2486,7 @@ int main()
24852486
return 2;
24862487
}
24872488
2488-
if (size < 1024 * 1024) {
2489+
if (size < 2 * 1024 * 1024) {
24892490
return 1;
24902491
}
24912492
return 0;
@@ -2497,7 +2498,7 @@ EOF
24972498
./conftest &>/dev/null
24982499
exitcode=$?
24992500
if test $exitcode -eq 1; then
2500-
ac_cv_thread_stack_size=1048576
2501+
ac_cv_thread_stack_size=2097152 # 2 MiB
25012502
elif test $exitcode -eq 0; then
25022503
ac_cv_thread_stack_size="default"
25032504
fi

0 commit comments

Comments
 (0)