python*: set thread stack size on musl

Ensure recursion limit is reached before stack overflow.

Python does this for OSX and BSD:
https://github.com/python/cpython/blob/13ff24582c99dfb439b1af7295b401415e7eb05b/Python/thread_pthread.h#L22

Size of 1MB chosen to match value in Alpine:
https://git.alpinelinux.org/cgit/aports/commit/main/python2/APKBUILD?id=2f35283fec8ec451fe5fb477dd32ffdcc0776e89

Manual testing via Alpine's test-stacksize.py crashes on these
previously, and works with these changes.
This commit is contained in:
Will Dietz
2018-03-20 08:14:04 -05:00
parent 7e44f19fce
commit 9aa22191cf
4 changed files with 11 additions and 1 deletions
@@ -122,6 +122,9 @@ in stdenv.mkDerivation {
${optionalString stdenv.isDarwin ''
export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -msse2"
export MACOSX_DEPLOYMENT_TARGET=10.6
''
+ optionalString stdenv.hostPlatform.isMusl ''
export NIX_CFLAGS_COMPILE+=" -DTHREAD_STACK_SIZE=0x100000"
''}
'';